diff --git a/src/fennel-ls.fnl b/src/fennel-ls.fnl index 9981218..5de2ded 100644 --- a/src/fennel-ls.fnl +++ b/src/fennel-ls.fnl @@ -31,10 +31,10 @@ (λ main-loop [in out] (local send (partial json-rpc.write out)) - (local state []) + (local server {}) (while true (let [msg (json-rpc.read in)] - (dispatch.handle state send msg)))) + (dispatch.handle server send msg)))) (λ main [] (case arg diff --git a/src/fennel-ls/files.fnl b/src/fennel-ls/files.fnl index 59524f6..67c2086 100644 --- a/src/fennel-ls/files.fnl +++ b/src/fennel-ls/files.fnl @@ -18,7 +18,7 @@ in the \"server\" object." (let [body (file:read :*a)] (file:close) body) - (error (.. "failed to open file" uri)))))] + (error (.. "failed to open file " uri)))))] {: uri : text})) (λ get-by-uri [server uri] diff --git a/test/code-action.fnl b/test/code-action.fnl index ddc5e0b..a04cce2 100644 --- a/test/code-action.fnl +++ b/test/code-action.fnl @@ -36,6 +36,11 @@ "(let [x 0] (print x))")) +(fn test-fix-unused-definition [] + (check "(local x==== 10)" + "unused-definition" + "(local _x 10)")) + ; (fn test-fix-method-function [] ; (check "(local x {}) ; (fn x:y [a b c] @@ -45,4 +50,5 @@ ; (fn x.y [client a b c] ; (print client a b c))")) -{: test-fix-op-no-arguments} +{: test-fix-op-no-arguments + : test-fix-unused-definition} diff --git a/test/init.fnl b/test/init.fnl index 4fd7b6c..a1a547e 100644 --- a/test/init.fnl +++ b/test/init.fnl @@ -1,14 +1,3 @@ -(local fennel (require :fennel)) -(set debug.traceback fennel.traceback) -(local old-debug-getinfo debug.getinfo) -(fn debug.getinfo [x] - (let [{: sourcemap} (require :fennel.compiler) - info (old-debug-getinfo (+ 1 x))] - (when info - (set info.currentline (or (?. sourcemap info.source info.currentline 2) info.currentline)) - (set info.linedefined (or (?. sourcemap info.source info.linedefined 2) info.linedefined))) - info)) - (local faith (require :faith)) (faith.run diff --git a/tools/util/sh.fnl b/tools/util/sh.fnl index 4251fce..86c6f32 100644 --- a/tools/util/sh.fnl +++ b/tools/util/sh.fnl @@ -15,6 +15,6 @@ "'"))) " ")] (print (.. "running command: " command)) - (os.execute command))) + (assert (os.execute command)))) {: sh}