diff --git a/TODO.md b/TODO.md index 34cc5e5..2c0aa29 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,10 @@ # Wishlist of features ([X] = complete, [ ] = planned) -Each subsection is increasingly more of a stretch goal. + My current goal is to work on completions a little bit more. +Here is my feature wishlist. I don't expect to ever get all of this done, but these are the sort of enhancements I am thinking about. - [X] Able to connect to a client - [ ] Support for UTF-8 characters that aren't just plain ASCII. (especially `λ`) (perhaps just tell the IDE that I want to communicate with utf-8 offsets) - [ ] Settings to configure lua / fennel path, allowed globals, etc @@ -26,7 +27,7 @@ My current goal is to work on completions a little bit more. - [X] table mutation via `fn` special: `(fn obj.new-field [])` - [ ] macro calls / which macros are in scope - [ ] setmetatable - - [ ] function arguments / function calls + - [ ] can search through function arguments / function calls / method calls - [ ] local/table mutation via set/tset - [ ] .lua files (antifennel decompiler) - [ ] mutation on aliased tables (difficult) @@ -50,7 +51,7 @@ My current goal is to work on completions a little bit more. - [ ] Reports linting issues - [X] Unused locals - [ ] Discarding results from pcall/xpcall/other functions - - [ ] `unpack` or `values` into an operator special + - [ ] `unpack` or `values` into a special - [ ] `do`/`values` with only one inner form - [ ] redundant `do` as the last/only item in a form that accepts a "body" - [ ] `var` forms that could be `local` @@ -82,4 +83,3 @@ My current goal is to work on completions a little bit more. - [ ] arbitrary fields (may affect code behavior, may modify other files) - [ ] formatting with fnlfmt - [ ] Type annotations? Global type inference? - diff --git a/test/completion-test.fnl b/test/completion-test.fnl index cda579d..91155b6 100644 --- a/test/completion-test.fnl +++ b/test/completion-test.fnl @@ -5,17 +5,15 @@ (local {: ROOT-URI : create-client} (require :test.mock-client)) -(local dispatch (require :fennel-ls.dispatch)) -(local message (require :fennel-ls.message)) - (local filename (.. ROOT-URI "/imaginary-file.fnl")) (fn check-completion [body line col expected ?unexpected] (let [client (doto (create-client) (: :open-file! filename body)) - response (client:completion filename line col) - seen (collect [_ suggestion (ipairs (. response 1 :result))] - suggestion.label suggestion.label)] + [{: result}] (client:completion filename line col) + seen (if result + (collect [_ suggestion (ipairs result)] + suggestion.label suggestion.label))] (if expected (each [_ exp (ipairs expected)] (is (. seen exp) (.. exp " was not suggested, but should be")))) @@ -23,14 +21,6 @@ (each [_ exp (ipairs ?unexpected)] (is.nil (. seen exp) (.. exp " was suggested, but shouldn't be")))))) -(fn check-no-completion [body line col expected ?unexpected] - (let [client (doto (create-client) - (: :open-file! filename body)) - response (client:completion filename line col)] - (is-matching (. response 1) - {: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])) @@ -74,7 +64,7 @@ (check-completion "(local x {:field (fn [])})\n(x:" 1 3 [:field] [:local])) (it "doesn't crash with a partially typed multisym contains ::" - (check-no-completion "(local x {:field (fn [])})\n(x::f" 1 3 [:field]))) + (check-completion "(local x {:field (fn [])})\n(x::f" 1 3 []))) ;; Functions (it "suggests function arguments at the top scope of the function" diff --git a/test/diagnostic-test.fnl b/test/diagnostic-test.fnl index 66faa19..f06c237 100644 --- a/test/diagnostic-test.fnl +++ b/test/diagnostic-test.fnl @@ -5,9 +5,6 @@ (local {: ROOT-URI : create-client} (require :test.mock-client)) -(local dispatch (require :fennel-ls.dispatch)) -(local message (require :fennel-ls.message)) - (macro find [t body ?sentinel] (assert-compile (not ?sentinel) "you can only have one thing here, put a `(do)`") (assert-compile (sequence? t) "[] square brackets please") diff --git a/test/goto-definition-test.fnl b/test/goto-definition-test.fnl index b326070..6733e37 100644 --- a/test/goto-definition-test.fnl +++ b/test/goto-definition-test.fnl @@ -5,9 +5,6 @@ (local {: ROOT-URI : create-client} (require :test.mock-client)) -(local dispatch (require :fennel-ls.dispatch)) -(local message (require :fennel-ls.message)) - (describe "jump to definition" (fn check [request-file line char response-file start-line start-col end-line end-col] diff --git a/test/hover-test.fnl b/test/hover-test.fnl index c6ac086..72dd269 100644 --- a/test/hover-test.fnl +++ b/test/hover-test.fnl @@ -5,9 +5,6 @@ (local {: ROOT-URI : create-client} (require :test.mock-client)) -(local dispatch (require :fennel-ls.dispatch)) -(local message (require :fennel-ls.message)) - (describe "hover" (fn check [request-file line char response-string] diff --git a/test/settings-test.fnl b/test/settings-test.fnl index 01a458d..f66c6e5 100644 --- a/test/settings-test.fnl +++ b/test/settings-test.fnl @@ -11,7 +11,7 @@ result (client:definition (.. ROOT-URI :/test.fnl) 0 12)] (is-matching result - [{:result {:range message}}] + [{:result {:range _range}}] "error message"))) ;; (it "can set the path" diff --git a/test/string-processing-test.fnl b/test/string-processing-test.fnl index 550c194..6da6237 100644 --- a/test/string-processing-test.fnl +++ b/test/string-processing-test.fnl @@ -64,3 +64,5 @@ "this is the\nold file" [{:text "And this is the\nnew file"}]) "And this is the\nnew file")))) + + ;; (it "can substitute multiple ranges")