Allow configuration through initialization options

This commit is contained in:
adjuvant 2023-08-26 16:39:58 +02:00 committed by XeroOl
parent 41a84c5540
commit 31ea7a1039
2 changed files with 16 additions and 2 deletions

View File

@ -120,7 +120,7 @@ However, fennel-ls can fall back to positionEncoding=utf-16 (with a performance
(set self.modules {})
(set self.root-uri params.rootUri)
(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]
(set self.configuration (make-configuration ?configuration)))

View File

@ -3,6 +3,7 @@
(local {: view} (require :fennel))
(local {: ROOT-URI
: ROOT-PATH
: create-client} (require :test.client))
(describe "settings"
@ -44,4 +45,17 @@
(is-matching responses
[{:method :textDocument/publishDiagnostics
: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"))))