Add tests for editing flsconfig

This commit is contained in:
XeroOl 2024-07-29 19:17:18 -05:00
parent c1f9dc448a
commit 58c79a727e
2 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,6 @@
(local faith (require :faith))
(local {: create-client} (require :test.utils))
(local fennel (require :fennel))
(fn test-path []
(let [{: client : uri : cursor :locations [location]}
@ -60,7 +61,18 @@
(faith.not= [] bad)
(faith.= [] good)))
(fn test-editing-settings []
(let [{: client : uri} (create-client {:main.fnl ""
:flsproject.fnl "{}"})
uri (uri:gsub "main" "flsproject")]
(client:pretend-this-file-exists! uri "{:extra-globals \"my-new-global\"}")
(client:did-save uri)
(faith.= "my-new-global" client.server.configuration.extra-globals)
(local _ nil))
nil)
{: test-path
: test-extra-globals
: test-lints
: test-native-libaries}
: test-native-libaries
: test-editing-settings}

View File

@ -63,6 +63,12 @@
:textDocument {:uri file}
:context {:diagnostics []}})))
(fn did-save [self file]
(dispatch.handle* self.server
(message.create-notification :textDocument/didSave
{:textDocument {:uri file}})))
(local client-mt
{:__index {: open-file!
: pretend-this-file-exists!
@ -71,7 +77,8 @@
: hover
: references
: rename
: code-action}})
: code-action
: did-save}})
{: client-mt
: default-encoding