[PATCH fennel-ls 1/1] Allow configuration through initialization options
Export this patch
From: adjuvant <adjuvant@mailbox.org>
---
src/fennel-ls/state.fnl | 2 + -
test/settings-test.fnl | 16 +++++++++++++++ -
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/fennel-ls/state.fnl b/src/fennel-ls/state.fnl
index c944af0..e4b158b 100644
--- a/src/fennel-ls/state.fnl
+++ b/src/fennel-ls/state.fnl
@@ -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)))
diff --git a/test/settings-test.fnl b/test/settings-test.fnl
index fe28944..5f84230 100644
--- a/test/settings-test.fnl
+++ b/test/settings-test.fnl
@@ -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"))))
--
2.38.5
fennel-ls/patches/.build.yml: SUCCESS in 46s
[Allow configuration through initialization options][0] from [~adjuvant][1]
[0]: https://lists.sr.ht/~xerool/fennel-ls/patches/43991
[1]: mailto:adjuvant@mailbox.org
✓ #1047727 SUCCESS fennel-ls/patches/.build.yml https://builds.sr.ht/~xerool/job/1047727