Fix indeterminate analyze search results.

This commit is contained in:
Phil Hagelberg 2025-03-02 21:45:57 -08:00
parent 1c2f5364be
commit 356c6bcae7
3 changed files with 7 additions and 6 deletions

View File

@ -73,7 +73,7 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
(. document.fields (. stack (length stack))))
(search-document server (. document.fields (table.remove stack)) stack opts)
(not document.fields)
(set opts.searched-through-require-indeterminate true)))
{:indeterminate true}))
(λ search-val [server file ?ast stack opts]
"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 :λ))))
(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
(λ [server file ?ast stack multival opts]

View File

@ -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)]
(case-try (analyzer.find-symbol file.ast byte)
symbol (analyzer.search-main server file symbol {} {: byte})
result {:contents (formatter.hover-format result)
:range (message.ast->range server file symbol)}
{:indeterminate nil &as result} {:contents (formatter.hover-format result)
:range (message.ast->range server file
symbol)}
(catch _ nil))))
(λ make-completion-item [server file name scope]

View File

@ -57,8 +57,7 @@ the `file.diagnostics` field, filling it with diagnostics."
(let [opts {}
item (analyzer.search-ast server file ?ast stack opts)]
(if (and (not item)
opts.searched-through-require-with-stack-size-1
(not opts.searched-through-require-indeterminate))
opts.searched-through-require-with-stack-size-1)
(diagnostic
{:range (message.ast->range server file symbol)
:message (.. "unknown field: " (tostring symbol))