fix initialization options ignoring symbol splitting

This commit is contained in:
XeroOl 2025-08-22 19:00:28 -05:00
parent fe3fd3340d
commit 13b75260b2
2 changed files with 10 additions and 6 deletions

View File

@ -209,12 +209,9 @@ initialization-opts: {:stack ?list[ast]
;; and the stack has ["baz" "bar"]. "bar" is at the "top"/"end" of the stack as the next key to search.
(if (sym? ast)
;; when your search starts as a symbol, there's lots of special interesting things to consider
(let [stack
(if initialization-opts.stack
initialization-opts.stack
(let [?byte initialization-opts.byte
split (utils.multi-sym-split ast (if ?byte (- ?byte ast.bytestart)))]
(stack-add-split! [] split)))]
(let [stack (let [?byte initialization-opts.byte
split (utils.multi-sym-split ast (if ?byte (- ?byte ast.bytestart)))]
(stack-add-split! (or initialization-opts.stack []) split))]
(case (docs.get-builtin server (utils.multi-sym-base ast))
document (search-document server document stack opts)
_ (case (. file.macro-refs ast)

View File

@ -124,6 +124,13 @@
(check "package.loaded.mymodule io.stderr.write"
[]
[{:code :unknown-module-field}])
;; regression test
(check {:numbers.fnl "{:field [1 2 3]}"
:main.fnl "(local n (require :numbers))
(local [one two three] n.field)
(print one two three)"}
[]
[{:code :unknown-module-field}])
nil)
(fn test-unnecessary-method []