refactoring and starting to implement settings

This commit is contained in:
XeroOl 2022-09-21 21:26:55 -05:00
parent cd4358a4b7
commit 566b475ff8
No known key found for this signature in database
GPG Key ID: 9DD4B4B4DAED0322
3 changed files with 11 additions and 8 deletions

View File

@ -55,11 +55,11 @@ Every time the client sends a message, it gets handled by a function in the corr
;; :workspaceSymbolProvider nil ;; :workspaceSymbolProvider nil
;; :workspace {:workspaceFolders nil ;; :workspace {:workspaceFolders nil
;; :documentOperations {:didCreate nil ;; :documentOperations {:didCreate nil
;; :willCreate nil ;; :willCreate nil
;; :didRename nil ;; :didRename nil
;; :willRename nil ;; :willRename nil
;; :didDelete nil ;; :didDelete nil
;; :willDelete nil}}) ;; :willDelete nil}})
(λ requests.initialize [self send params] (λ requests.initialize [self send params]
(state.init-state self params) (state.init-state self params)
@ -158,6 +158,10 @@ Every time the client sends a message, it gets handled by a function in the corr
(local file (state.get-by-uri self uri)) (local file (state.get-by-uri self uri))
(set file.open? false)) (set file.open? false))
(λ notifications.workspace/didChangeConfiguration [self send params]
(set self.settings params.fennel-ls))
;; TODO respect the settings
(λ requests.shutdown [self send] (λ requests.shutdown [self send]
"The server still needs to respond to this request, so the program can't close yet. Just wait until notifications.exit" "The server still needs to respond to this request, so the program can't close yet. Just wait until notifications.exit"
nil) nil)

View File

@ -18,7 +18,7 @@
(let [response (dispatch.handle* state (completion-at filename line col)) (let [response (dispatch.handle* state (completion-at filename line col))
seen (collect [_ suggestion (ipairs (. response 1 :result))] seen (collect [_ suggestion (ipairs (. response 1 :result))]
suggestion.label suggestion.label)] suggestion.label suggestion.label)]
(if (= (type expected) :table) (if expected
(each [_ exp (ipairs expected)] (each [_ exp (ipairs expected)]
(is.truthy (. seen exp) (.. exp " was not suggested, but should be")))) (is.truthy (. seen exp) (.. exp " was not suggested, but should be"))))
(if ?unexpected (if ?unexpected
@ -33,7 +33,6 @@
{:jsonrpc "2.0" :id id :result nil} {:jsonrpc "2.0" :id id :result nil}
"there shouldn't be a result"))) "there shouldn't be a result")))
(describe "completions" (describe "completions"
(it "suggests globals" (it "suggests globals"
(check-completion "(" 0 1 [:_G :debug :table :io :getmetatable :setmetatable :_VERSION :ipairs :pairs :next])) (check-completion "(" 0 1 [:_G :debug :table :io :getmetatable :setmetatable :_VERSION :ipairs :pairs :next]))