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
;; :workspace {:workspaceFolders nil
;; :documentOperations {:didCreate nil
;; :willCreate nil
;; :didRename nil
;; :willRename nil
;; :didDelete nil
;; :willDelete nil}})
;; :willCreate nil
;; :didRename nil
;; :willRename nil
;; :didDelete nil
;; :willDelete nil}})
(λ requests.initialize [self send 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))
(set file.open? false))
(λ notifications.workspace/didChangeConfiguration [self send params]
(set self.settings params.fennel-ls))
;; TODO respect the settings
(λ 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"
nil)

View File

@ -22,7 +22,7 @@ the data provided by compiler.fnl."
:definition ?definition
:keys ?keys
:fields ?fields} assignment]
(if (and (= 0 (length stack)) opts.stop-early?)
(if (and (= 0 (length stack)) opts.stop-early?)
(values assignment file) ;; BASE CASE!!
(and (not= 0 (length stack)) (?. ?fields (. stack (length stack))))

View File

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