fix positionEncoding to be a capability

This commit is contained in:
XeroOl 2024-05-15 22:58:51 -05:00
parent 3dc9e36af6
commit 1a21ee623d
2 changed files with 53 additions and 53 deletions

View File

@ -17,14 +17,17 @@ Every time the client sends a message, it gets handled by a function in the corr
(local requests []) (local requests [])
(local notifications []) (local notifications [])
(local capabilities (λ requests.initialize [self send params]
{:textDocumentSync {:openClose true :change 2} (state.init-state self params)
(let [capabilities
{:positionEncoding self.position-encoding
:textDocumentSync {:openClose true :change 2}
;; :notebookDocumentSync nil ;; :notebookDocumentSync nil
:completionProvider {:workDoneProgress false} :completionProvider {:workDoneProgress false
:hoverProvider {:workDoneProgress false
:resolveProvider false :resolveProvider false
:triggerCharacters ["(" "[" "{" "." ":" "\""] :triggerCharacters ["(" "[" "{" "." ":" "\""]
:completionItem {:labelDetailsSupport false}} :completionItem {:labelDetailsSupport false}}
:hoverProvider {:workDoneProgress false}
;; :signatureHelpProvider nil ;; :signatureHelpProvider nil
;; :declarationProvider nil ;; :declarationProvider nil
:definitionProvider {:workDoneProgress false} :definitionProvider {:workDoneProgress false}
@ -37,10 +40,10 @@ Every time the client sends a message, it gets handled by a function in the corr
;; :codeLensProvider nil ;; :codeLensProvider nil
;; :documentLinkProvider nil ;; :documentLinkProvider nil
;; :colorProvider nil ;; :colorProvider nil
;; :documentFormattingProvider nil ;; :documentFormattingProvider {:workDoneProgress false}
;; :documentRangeFormattingProvider nil ;; :documentRangeFormattingProvider nil
;; :documentOnTypeFormattingProvider nil ;; :documentOnTypeFormattingProvider nil
:renameProvider {:workDoneProgress false}}) :renameProvider {:workDoneProgress false}}]
;; :foldingRangeProvider nil ;; :foldingRangeProvider nil
;; :executeCommandProvider nil ;; :executeCommandProvider nil
;; :selectionRangeProvider nil ;; :selectionRangeProvider nil
@ -55,18 +58,15 @@ Every time the client sends a message, it gets handled by a function in the corr
;; :diagnosticProvider {:workDoneProgress false}}) ;; :diagnosticProvider {:workDoneProgress false}})
;; :workspaceSymbolProvider nil ;; :workspaceSymbolProvider nil
;; :workspace {:workspaceFolders nil ;; :workspace {:workspaceFolders nil
;; :documentOperations {:didCreate nil ;; :fileOperations {:didCreate nil
;; :willCreate nil ;; :willCreate nil
;; :didRename nil ;; :didRename nil
;; :willRename nil ;; :willRename nil
;; :didDelete nil ;; :didDelete nil
;; :willDelete nil}}) ;; :willDelete nil}}
;; :experimental nil)
(λ requests.initialize [self send params] {: capabilities
(state.init-state self params) :serverInfo {:name "fennel-ls" :version "0.1.0"}}))
{:capabilities capabilities
:positionEncoding self.position-encoding
:serverInfo {:name "fennel-ls" :version "0.1.0"}})
(λ requests.textDocument/definition [self send {: position :textDocument {: uri}}] (λ requests.textDocument/definition [self send {: position :textDocument {: uri}}]
(let [file (state.get-by-uri self uri) (let [file (state.get-by-uri self uri)

View File

@ -15,7 +15,7 @@
(fn test-offset-encoding [] (fn test-offset-encoding []
(let [(self [response]) (let [(self [response])
(create-client {:params (params-with-encodings [:utf-16])}) (create-client {:params (params-with-encodings [:utf-16])})
_ (faith.= :utf-16 (. response :result :positionEncoding)) _ (faith.= :utf-16 (. response :result :capabilities :positionEncoding))
{: text : cursor :ranges [{: start : end}]} (get-markup "(let [==𐐀𐐀== 100] 𐐀𐐀|)" :utf-16) {: text : cursor :ranges [{: start : end}]} (get-markup "(let [==𐐀𐐀== 100] 𐐀𐐀|)" :utf-16)
_ (self:open-file! "foo.fnl" text) _ (self:open-file! "foo.fnl" text)
[response] (self:definition "foo.fnl" cursor)] [response] (self:definition "foo.fnl" cursor)]
@ -24,7 +24,7 @@
(let [(self [response]) (let [(self [response])
(create-client {:params (params-with-encodings [:utf-16 :utf-8])}) (create-client {:params (params-with-encodings [:utf-16 :utf-8])})
_ (faith.= :utf-8 (. response :result :positionEncoding)) _ (faith.= :utf-8 (. response :result :capabilities :positionEncoding))
{: text : cursor :ranges [{: start : end}]} (get-markup "(let [==𐐀𐐀== 100] 𐐀𐐀|)" :utf-8) {: text : cursor :ranges [{: start : end}]} (get-markup "(let [==𐐀𐐀== 100] 𐐀𐐀|)" :utf-8)
_ (self:open-file! "foo.fnl" text) _ (self:open-file! "foo.fnl" text)
[response] (self:definition "foo.fnl" cursor)] [response] (self:definition "foo.fnl" cursor)]
@ -33,13 +33,13 @@
;; utf-16 is the fallback ;; utf-16 is the fallback
(let [(_ [response]) (create-client {:params (params-with-encodings nil)})] (let [(_ [response]) (create-client {:params (params-with-encodings nil)})]
(faith.= :utf-16 (. response :result :positionEncoding))) (faith.= :utf-16 (. response :result :capabilities :positionEncoding)))
(let [(_ [response]) (create-client {:params (params-with-encodings [:random-encoding])})] (let [(_ [response]) (create-client {:params (params-with-encodings [:random-encoding])})]
(faith.= :utf-16 (. response :result :positionEncoding))) (faith.= :utf-16 (. response :result :capabilities :positionEncoding)))
(let [(_ [response]) (create-client {:params (params-with-encodings [:utf-8 :utf-16])})] (let [(_ [response]) (create-client {:params (params-with-encodings [:utf-8 :utf-16])})]
(faith.= :utf-8 (. response :result :positionEncoding))) (faith.= :utf-8 (. response :result :capabilities :positionEncoding)))
nil) nil)