insert/replace completion support
LSP protocol describes two types of completion: insert, and replace. It turns out its really easy to support this. The hard part is just checking if the client actually wants it.
This commit is contained in:
parent
0828820097
commit
c78f5411bf
@ -136,7 +136,11 @@ is set to true and we report that we support completionItem/resolve."
|
||||
(expression-completions)))
|
||||
|
||||
(if server.can-do-good-completions?
|
||||
{:itemDefaults {:editRange range :data {: uri : byte}}
|
||||
{:itemDefaults {:editRange (if server.can-do-insert-replace-completions?
|
||||
{:insert {:start range.start :end position}
|
||||
:replace range}
|
||||
range)
|
||||
:data {: uri : byte}}
|
||||
:items results}
|
||||
results)))
|
||||
|
||||
|
||||
@ -132,6 +132,7 @@ However, when not an option, fennel-ls will fall back to positionEncoding=\"utf-
|
||||
(case (?. params :capabilities :textDocument :completion :completionList :itemDefaults)
|
||||
completion-item-defaults (and (accumulate [found nil _ v (ipairs completion-item-defaults) &until found] (= v :editRange))
|
||||
(accumulate [found nil _ v (ipairs completion-item-defaults) &until found] (= v :data)))))
|
||||
(set server.can-do-insert-replace-completions? (?. params :capabilities :textDocument :completion :completionItem :insertReplaceSupport))
|
||||
(reload server))
|
||||
|
||||
{: initialize
|
||||
|
||||
Loading…
Reference in New Issue
Block a user