Fix indeterminate analyze search results.
This commit is contained in:
parent
1c2f5364be
commit
356c6bcae7
@ -73,7 +73,7 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
|
|||||||
(. document.fields (. stack (length stack))))
|
(. document.fields (. stack (length stack))))
|
||||||
(search-document server (. document.fields (table.remove stack)) stack opts)
|
(search-document server (. document.fields (table.remove stack)) stack opts)
|
||||||
(not document.fields)
|
(not document.fields)
|
||||||
(set opts.searched-through-require-indeterminate true)))
|
{:indeterminate true}))
|
||||||
|
|
||||||
(λ search-val [server file ?ast stack opts]
|
(λ search-val [server file ?ast stack opts]
|
||||||
"searches for the definition of the ast, adjusted to 1 value"
|
"searches for the definition of the ast, adjusted to 1 value"
|
||||||
@ -158,7 +158,8 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
|
|||||||
(sym? head :lambda)
|
(sym? head :lambda)
|
||||||
(sym? head :λ))))
|
(sym? head :λ))))
|
||||||
|
|
||||||
(search-multival server file (. definition (length definition)) stack multival opts)))))))
|
(search-multival server file (. definition (length definition)) stack multival opts)
|
||||||
|
result result))))))
|
||||||
|
|
||||||
(set search-multival
|
(set search-multival
|
||||||
(λ [server file ?ast stack multival opts]
|
(λ [server file ?ast stack multival opts]
|
||||||
|
|||||||
@ -140,8 +140,9 @@ Every time the client sends a message, it gets handled by a function in the corr
|
|||||||
byte (utils.position->byte file.text position server.position-encoding)]
|
byte (utils.position->byte file.text position server.position-encoding)]
|
||||||
(case-try (analyzer.find-symbol file.ast byte)
|
(case-try (analyzer.find-symbol file.ast byte)
|
||||||
symbol (analyzer.search-main server file symbol {} {: byte})
|
symbol (analyzer.search-main server file symbol {} {: byte})
|
||||||
result {:contents (formatter.hover-format result)
|
{:indeterminate nil &as result} {:contents (formatter.hover-format result)
|
||||||
:range (message.ast->range server file symbol)}
|
:range (message.ast->range server file
|
||||||
|
symbol)}
|
||||||
(catch _ nil))))
|
(catch _ nil))))
|
||||||
|
|
||||||
(λ make-completion-item [server file name scope]
|
(λ make-completion-item [server file name scope]
|
||||||
|
|||||||
@ -57,8 +57,7 @@ the `file.diagnostics` field, filling it with diagnostics."
|
|||||||
(let [opts {}
|
(let [opts {}
|
||||||
item (analyzer.search-ast server file ?ast stack opts)]
|
item (analyzer.search-ast server file ?ast stack opts)]
|
||||||
(if (and (not item)
|
(if (and (not item)
|
||||||
opts.searched-through-require-with-stack-size-1
|
opts.searched-through-require-with-stack-size-1)
|
||||||
(not opts.searched-through-require-indeterminate))
|
|
||||||
(diagnostic
|
(diagnostic
|
||||||
{:range (message.ast->range server file symbol)
|
{:range (message.ast->range server file symbol)
|
||||||
:message (.. "unknown field: " (tostring symbol))
|
:message (.. "unknown field: " (tostring symbol))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user