Allow configuration through initialization options
This commit is contained in:
parent
41a84c5540
commit
31ea7a1039
@ -120,7 +120,7 @@ However, fennel-ls can fall back to positionEncoding=utf-16 (with a performance
|
|||||||
(set self.modules {})
|
(set self.modules {})
|
||||||
(set self.root-uri params.rootUri)
|
(set self.root-uri params.rootUri)
|
||||||
(set self.position-encoding (choose-position-encoding params))
|
(set self.position-encoding (choose-position-encoding params))
|
||||||
(set self.configuration (make-configuration)))
|
(set self.configuration (make-configuration (?. params :initializationOptions :fennel-ls))))
|
||||||
|
|
||||||
(λ write-configuration [self ?configuration]
|
(λ write-configuration [self ?configuration]
|
||||||
(set self.configuration (make-configuration ?configuration)))
|
(set self.configuration (make-configuration ?configuration)))
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
(local {: view} (require :fennel))
|
(local {: view} (require :fennel))
|
||||||
|
|
||||||
(local {: ROOT-URI
|
(local {: ROOT-URI
|
||||||
|
: ROOT-PATH
|
||||||
: create-client} (require :test.client))
|
: create-client} (require :test.client))
|
||||||
|
|
||||||
(describe "settings"
|
(describe "settings"
|
||||||
@ -44,4 +45,17 @@
|
|||||||
(is-matching responses
|
(is-matching responses
|
||||||
[{:method :textDocument/publishDiagnostics
|
[{:method :textDocument/publishDiagnostics
|
||||||
:params {:diagnostics [nil]}}]
|
:params {:diagnostics [nil]}}]
|
||||||
"bad"))))
|
"bad")))
|
||||||
|
|
||||||
|
(it "can be configured with initialization options"
|
||||||
|
(let [initializationOptions {:fennel-ls {:checks {:unused-definition false}}}
|
||||||
|
client (create-client {:params {: initializationOptions
|
||||||
|
:rootPath ROOT-PATH
|
||||||
|
:rootUri ROOT-URI
|
||||||
|
:workspaceFolders [{:name ROOT-PATH
|
||||||
|
:uri ROOT-URI}]}})
|
||||||
|
responses (client:open-file! (.. ROOT-URI :/test.fnl) "(local x 10)")]
|
||||||
|
(is-matching responses
|
||||||
|
[{:method :textDocument/publishDiagnostics
|
||||||
|
:params {:diagnostics [nil]}}]
|
||||||
|
"settings should apply when set through initializationOptions"))))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user