Remove error response when hovering over nothing
This commit is contained in:
parent
0d8b927929
commit
06a6e8c7ea
@ -37,7 +37,7 @@ Features / To Do List / Things I would enjoy patches for:
|
|||||||
- [ ] from macros (only on first form in a list)
|
- [ ] from macros (only on first form in a list)
|
||||||
- [ ] from specials (only on first form in a list)
|
- [ ] from specials (only on first form in a list)
|
||||||
- [X] "dot completion" for table fields
|
- [X] "dot completion" for table fields
|
||||||
- [ ] dot completion is aware of a string's fields
|
- [ ] dot completion is aware of a stdlib
|
||||||
- [ ] from anywhere else that I'm forgetting right now
|
- [ ] from anywhere else that I'm forgetting right now
|
||||||
- [ ] actually compliant rules about lexical scope (only see things declared before, not after)
|
- [ ] actually compliant rules about lexical scope (only see things declared before, not after)
|
||||||
- [ ] show docs/icons on each suggestion
|
- [ ] show docs/icons on each suggestion
|
||||||
|
|||||||
@ -89,7 +89,8 @@ Every time the client sends a message, it gets handled by a function in the corr
|
|||||||
(match-try (language.find-symbol file.ast byte)
|
(match-try (language.find-symbol file.ast byte)
|
||||||
symbol (language.search-main self file symbol {})
|
symbol (language.search-main self file symbol {})
|
||||||
result {:contents {:kind "markdown"
|
result {:contents {:kind "markdown"
|
||||||
:value (formatter.hover-format result)}})))
|
:value (formatter.hover-format result)}}
|
||||||
|
(catch _ nil))))
|
||||||
|
|
||||||
(λ collect-scope [scope typ callback ?target]
|
(λ collect-scope [scope typ callback ?target]
|
||||||
(let [result (or ?target [])]
|
(let [result (or ?target [])]
|
||||||
@ -150,6 +151,7 @@ Every time the client sends a message, it gets handled by a function in the corr
|
|||||||
(send (message.diagnostics file)))
|
(send (message.diagnostics file)))
|
||||||
|
|
||||||
(λ notifications.textDocument/didClose [self send {:textDocument {: uri}}]
|
(λ notifications.textDocument/didClose [self send {:textDocument {: uri}}]
|
||||||
|
;; TODO reload from disk if we didn't get a didSave
|
||||||
(local file (state.get-by-uri self uri))
|
(local file (state.get-by-uri self uri))
|
||||||
(set file.open? false))
|
(set file.open? false))
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,8 @@ the data provided by compiler.fnl."
|
|||||||
[-require- mod]
|
[-require- mod]
|
||||||
(let [newfile (state.get-by-module self mod)
|
(let [newfile (state.get-by-module self mod)
|
||||||
newitem (. newfile.ast (length newfile.ast))]
|
newitem (. newfile.ast (length newfile.ast))]
|
||||||
(search self newfile newitem stack opts))
|
(if newfile
|
||||||
|
(search self newfile newitem stack opts)))
|
||||||
; A . form indexes into item 1 with the other items
|
; A . form indexes into item 1 with the other items
|
||||||
[-dot- & split]
|
[-dot- & split]
|
||||||
(search self file (. split 1)
|
(search self file (. split 1)
|
||||||
|
|||||||
@ -40,7 +40,7 @@ I suspect this file is going to be gone after a bit of refactoring."
|
|||||||
(table.concat result ";")))
|
(table.concat result ";")))
|
||||||
|
|
||||||
(λ lookup [{: root-uri} mod]
|
(λ lookup [{: root-uri} mod]
|
||||||
(match (or (fennel.searchModule mod (add-workspaces-to-path luapath [root-uri]))
|
(match (or ;; TODO support lua ;; (fennel.searchModule mod (add-workspaces-to-path luapath [root-uri]))
|
||||||
(fennel.searchModule mod (add-workspaces-to-path fennelpath [root-uri])))
|
(fennel.searchModule mod (add-workspaces-to-path fennelpath [root-uri])))
|
||||||
modname (utils.path->uri modname)
|
modname (utils.path->uri modname)
|
||||||
nil nil))
|
nil nil))
|
||||||
|
|||||||
@ -42,9 +42,7 @@ object."
|
|||||||
uri
|
uri
|
||||||
(do
|
(do
|
||||||
(tset self.modules module uri)
|
(tset self.modules module uri)
|
||||||
(get-by-uri self uri))
|
(get-by-uri self uri)))))
|
||||||
nil
|
|
||||||
(error (.. "cannot find module " module)))))
|
|
||||||
|
|
||||||
(λ set-uri-contents [self uri text]
|
(λ set-uri-contents [self uri text]
|
||||||
(match (. self.files uri)
|
(match (. self.files uri)
|
||||||
|
|||||||
@ -44,4 +44,15 @@
|
|||||||
(check "hover.fnl" 12 9 "```fnl\nnil\n```"))
|
(check "hover.fnl" 12 9 "```fnl\nnil\n```"))
|
||||||
|
|
||||||
(it "hovers over λ function"
|
(it "hovers over λ function"
|
||||||
(check "hover.fnl" 18 6 "```fnl\n(fn lambda-fn [arg1 arg2] ...)\n```\ndocstring")))
|
(check "hover.fnl" 18 6 "```fnl\n(fn lambda-fn [arg1 arg2] ...)\n```\ndocstring"))
|
||||||
|
|
||||||
|
(it "hovers over literally the very first character"
|
||||||
|
(local state (doto [] setup-server))
|
||||||
|
(let [message (dispatch.handle* state
|
||||||
|
(message.create-request 2 "textDocument/hover"
|
||||||
|
{:position {:character 0 :line 0}
|
||||||
|
:textDocument {:uri (.. ROOT-URI "/hover.fnl")}}))]
|
||||||
|
(is-matching
|
||||||
|
message
|
||||||
|
[{:jsonrpc "2.0" :id 2}]
|
||||||
|
""))))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user