mark a bunch of things as unused

This commit is contained in:
XeroOl 2024-06-13 23:24:14 -05:00
parent 704aa3f7df
commit 3d2d738636
3 changed files with 23 additions and 23 deletions

View File

@ -148,7 +148,7 @@ identifiers are declared / referenced in which places."
(if (. references symbol)
(tset (. references symbol :target) :var-set true))))))
(λ destructure [to from scope {:declaration ?declaration? : symtype &as opts}]
(λ destructure [to from scope {:declaration ?declaration? :symtype _ &as opts}]
;; I really don't understand symtype
;; I think I need an explanation
(if ?declaration?
@ -195,10 +195,10 @@ identifiers are declared / referenced in which places."
;; handle the definitions of a function
(define-function-name ast scope))
(λ compile-for [ast scope binding]
(λ compile-for [_ast scope binding]
(define nil* binding scope))
(λ compile-each [ast scope bindings]
(λ compile-each [_ast scope bindings]
(each [_ binding (ipairs bindings)]
(define nil* binding scope)))
@ -225,7 +225,7 @@ identifiers are declared / referenced in which places."
;; fennel expands multisym calls into the `:` special, so we need to reference the symbol while we still can
(where method-call (= (type method-call) :string) (method-call:find ":"))
(reference head scope :read)
;; NOTE HACK TODO this should be removed once fennel makes if statements work like normal
;; NOTE this should be removed once fennel makes if statements work like normal
(where :if)
(let [len (length ast)]
(table.insert defer #(tset ast (+ len 1) nil))))))
@ -280,7 +280,7 @@ identifiers are declared / referenced in which places."
(call-me-to-reset-the-compiler)
(error "__NOT_AN_ERROR"))))
(λ on-parse-error [msg filename line byte _source call-me-to-reset-the-compiler]
(λ on-parse-error [msg _filename line byte _source call-me-to-reset-the-compiler]
(let [line (if (= line "?") 1 line)
range (line+byte->range server file line byte)]
(table.insert diagnostics

View File

@ -25,11 +25,11 @@ In general, this involves:
(.. "\"" method "\" is not in the request-handlers table")
id))))
(λ handle-response [server send id result]
(λ handle-response [_server _send _id _result]
;; I don't care about responses yet
nil)
(λ handle-bad-response [server send id err]
(λ handle-bad-response [_server _send _id err]
;; Handle a message indicating an error. Right now, it just crashes the server.
(error (.. "Client sent fennel-ls an error: " err.code)))

View File

@ -18,7 +18,7 @@ Every time the client sends a message, it gets handled by a function in the corr
(local requests [])
(local notifications [])
(λ requests.initialize [server send params]
(λ requests.initialize [server _send params]
(config.initialize server params)
(let [capabilities
{:positionEncoding server.position-encoding
@ -69,7 +69,7 @@ Every time the client sends a message, it gets handled by a function in the corr
{: capabilities
:serverInfo {:name "fennel-ls" :version "0.1.0"}}))
(λ requests.textDocument/definition [server send {: position :textDocument {: uri}}]
(λ requests.textDocument/definition [server _send {: position :textDocument {: uri}}]
(let [file (files.get-by-uri server uri)
byte (utils.position->byte file.text position server.position-encoding)]
(case-try (analyzer.find-symbol file.ast byte)
@ -85,9 +85,9 @@ Every time the client sends a message, it gets handled by a function in the corr
(message.range-and-uri server result.file (or result.binding result.definition)))
(catch _ nil))))
(λ requests.textDocument/references [server send {: position
:textDocument {: uri}
:context {:includeDeclaration ?include-declaration?}}]
(λ requests.textDocument/references [server _send {: position
:textDocument {: uri}
:context {:includeDeclaration ?include-declaration?}}]
(let [file (files.get-by-uri server uri)
byte (utils.position->byte file.text position server.position-encoding)]
(case-try (analyzer.find-symbol file.ast byte)
@ -104,7 +104,7 @@ Every time the client sends a message, it gets handled by a function in the corr
result)
(catch _ nil))))
(λ requests.textDocument/hover [server send {: position :textDocument {: uri}}]
(λ requests.textDocument/hover [server _send {: position :textDocument {: uri}}]
(let [file (files.get-by-uri server uri)
byte (utils.position->byte file.text position server.position-encoding)]
(case-try (analyzer.find-symbol file.ast byte)
@ -136,7 +136,7 @@ Every time the client sends a message, it gets handled by a function in the corr
def (formatter.completion-item-format name def)
_ {:label name}))
(λ scope-completion [server file byte ?symbol parents]
(λ scope-completion [server file _byte ?symbol parents]
(let [scope (or (accumulate [result nil
_ parent (ipairs parents)
&until result]
@ -183,7 +183,7 @@ Every time the client sends a message, it gets handled by a function in the corr
(formatter.completion-item-format label info)))
_ nil)))
(λ requests.textDocument/completion [server send {: position :textDocument {: uri}}]
(λ requests.textDocument/completion [server _send {: position :textDocument {: uri}}]
(let [file (files.get-by-uri server uri)
byte (utils.position->byte file.text position server.position-encoding)
(?symbol parents) (analyzer.find-symbol file.ast byte)]
@ -215,7 +215,7 @@ Every time the client sends a message, it gets handled by a function in the corr
(λ requests.textDocument/rename [server send {: position :textDocument {: uri} :newName new-name}]
(λ requests.textDocument/rename [server _send {: position :textDocument {: uri} :newName new-name}]
(let [file (files.get-by-uri server uri)
byte (utils.position->byte file.text position server.position-encoding)]
(case-try (analyzer.find-symbol file.ast byte)
@ -253,7 +253,7 @@ Every time the client sends a message, it gets handled by a function in the corr
(and (pos<= range-1.start range-2.end)
(pos<= range-2.start range-1.end)))
(λ requests.textDocument/codeAction [server send {: range :textDocument {: uri} &as params}]
(λ requests.textDocument/codeAction [server _send {: range :textDocument {: uri}}]
(let [file (files.get-by-uri server uri)]
(icollect [_ diagnostic (ipairs file.diagnostics)]
(if (and (overlap? diagnostic.range range)
@ -267,31 +267,31 @@ Every time the client sends a message, it gets handled by a function in the corr
(lint.check server file)
(send (message.diagnostics file)))
(λ notifications.textDocument/didOpen [server send {:textDocument {: languageId : text : uri}}]
(λ notifications.textDocument/didOpen [server send {:textDocument {: text : uri}}]
(local file (files.set-uri-contents server uri text))
(lint.check server file)
(send (message.diagnostics file))
(set file.open? true))
(λ notifications.textDocument/didSave [server send {:textDocument {: uri}}]
(λ notifications.textDocument/didSave [_server _send _server]
;; TODO be careful about which modules need to be recomputed, and also eagerly flush existing files
(set fennel.macro-loaded []))
(λ notifications.textDocument/didClose [server send {:textDocument {: uri}}]
(λ notifications.textDocument/didClose [server _send {:textDocument {: uri}}]
(local file (files.get-by-uri server uri))
(set file.open? false)
(set fennel.macro-loaded [])
;; TODO only reload from disk if we didn't get a didSave, instead of always
(files.flush-uri server uri))
(λ notifications.workspace/didChangeConfiguration [server send {: settings}]
(λ notifications.workspace/didChangeConfiguration [server _send {: settings}]
(config.write-configuration server (?. settings :fennel-ls)))
(λ requests.shutdown [server send]
(λ requests.shutdown [_server _send]
"The server still needs to respond to this request, so the program can't close yet. Just wait until notifications.exit"
nil)
(λ notifications.exit [server]
(λ notifications.exit [_server]
"This is the real shutdown request, we can quit now"
(os.exit 0))