tricky macro hidden scope completions
it's hard to tell which scope something is in. This makes completions a little better but it misses docs during good completion
This commit is contained in:
parent
dfa42610f7
commit
38cfd9a249
@ -112,6 +112,7 @@ identifiers are declared / referenced in which places."
|
|||||||
|
|
||||||
(λ symbol-to-expression [ast scope ?reference?]
|
(λ symbol-to-expression [ast scope ?reference?]
|
||||||
(assert (sym? ast) "symbols only")
|
(assert (sym? ast) "symbols only")
|
||||||
|
(tset scopes ast scope)
|
||||||
(reference ast scope (if ?reference?
|
(reference ast scope (if ?reference?
|
||||||
:read
|
:read
|
||||||
(not (multisym? ast))
|
(not (multisym? ast))
|
||||||
|
|||||||
@ -57,7 +57,8 @@ is set to true and we report that we support completionItem/resolve."
|
|||||||
&until ?find]
|
&until ?find]
|
||||||
(= (. ast 1) symbol)))
|
(= (. ast 1) symbol)))
|
||||||
;; find the first parent that contains a scope
|
;; find the first parent that contains a scope
|
||||||
scope (or (accumulate [?find nil _ parent (ipairs parents) &until ?find]
|
scope (or (. file.scopes symbol)
|
||||||
|
(accumulate [?find nil _ parent (ipairs parents) &until ?find]
|
||||||
(. file.scopes parent))
|
(. file.scopes parent))
|
||||||
file.scope)
|
file.scope)
|
||||||
range (case (message.ast->range server file symbol)
|
range (case (message.ast->range server file symbol)
|
||||||
@ -157,7 +158,8 @@ is set to true and we report that we support completionItem/resolve."
|
|||||||
(let [{: uri : byte} completion-item.data
|
(let [{: uri : byte} completion-item.data
|
||||||
file (files.get-by-uri server uri)
|
file (files.get-by-uri server uri)
|
||||||
(_symbol parents) (analyzer.find-symbol file.ast byte)
|
(_symbol parents) (analyzer.find-symbol file.ast byte)
|
||||||
scope (or (accumulate [?find nil _ parent (ipairs parents) &until ?find]
|
scope (or (. file.scopes _symbol)
|
||||||
|
(accumulate [?find nil _ parent (ipairs parents) &until ?find]
|
||||||
(. file.scopes parent))
|
(. file.scopes parent))
|
||||||
file.scope)
|
file.scope)
|
||||||
result (analyzer.search-name-and-scope server file completion-item.label scope)]
|
result (analyzer.search-name-and-scope server file completion-item.label scope)]
|
||||||
|
|||||||
@ -178,6 +178,11 @@
|
|||||||
{:kind #(= nil $)}
|
{:kind #(= nil $)}
|
||||||
{:label #(= nil $)}])
|
{:label #(= nil $)}])
|
||||||
|
|
||||||
|
(check "(case {}
|
||||||
|
identifier |"
|
||||||
|
[:identifier]
|
||||||
|
[]) ; TODO [{:documentation #(= nil $)}])
|
||||||
|
|
||||||
(each [_ mode (ipairs [true false])]
|
(each [_ mode (ipairs [true false])]
|
||||||
(check "(fn x [a b c]
|
(check "(fn x [a b c]
|
||||||
\"docstring\"
|
\"docstring\"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user