diff --git a/src/fennel-ls/compiler.fnl b/src/fennel-ls/compiler.fnl index 7d0c2e1..1525c3f 100644 --- a/src/fennel-ls/compiler.fnl +++ b/src/fennel-ls/compiler.fnl @@ -327,7 +327,6 @@ later by fennel-ls.language to answer requests from the client." (set file.definitions-by-scope definitions-by-scope) (set file.diagnostics diagnostics) (set file.references references) - (set file.deep-references references) (set file.require-calls require-calls) (set file.allowed-globals allowed-globals)))) diff --git a/src/fennel-ls/utils.fnl b/src/fennel-ls/utils.fnl index d7feee8..4a0808e 100644 --- a/src/fennel-ls/utils.fnl +++ b/src/fennel-ls/utils.fnl @@ -135,10 +135,13 @@ WARNING: this is only used in the test code, not in the real language server" {:range {: start : end} : newText} (replace contents start end newText encoding)))) -(λ get-ast-info [?ast info] - ;; find a given key of info from an AST object - (or (?. (getmetatable ?ast) info) - (?. ?ast info))) +(λ get-ast-info [ast info] + "gets `info` from ast if possible" + (if (= :number (type ast)) + nil + ;; find a given key of info from an AST object + (or (?. (getmetatable ast) info) + (?. ast info)))) (fn multi-sym-split [symbol ?offset] (local symbol (tostring symbol)) diff --git a/test/goto-definition-test.fnl b/test/goto-definition-test.fnl index 830587c..09b644d 100644 --- a/test/goto-definition-test.fnl +++ b/test/goto-definition-test.fnl @@ -97,6 +97,13 @@ :range {:start {:line 0 :character 4} :end {:line 0 :character 5}}}}]))) + (it "doesn't crash when doing this" + (let [c (create-client) + _ (c:open-file! :foo.fnl "(macro cool [a b] `(let [,b 10] ,a))\n(cool x x)") + _response (c:definition :foo.fnl 1 6) + _response (c:definition :foo.fnl 1 8)] + nil)) + ;; (it "can go through more than one extra file") ;; (it "will give up instead of freezing on recursive requires") ;; (it "finds the definition of in-file macros")