From 13b75260b236ba7efd91025b3fd273f78a94e8a2 Mon Sep 17 00:00:00 2001 From: XeroOl Date: Fri, 22 Aug 2025 19:00:28 -0500 Subject: [PATCH] fix initialization options ignoring symbol splitting --- src/fennel-ls/analyzer.fnl | 9 +++------ test/lint.fnl | 7 +++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/fennel-ls/analyzer.fnl b/src/fennel-ls/analyzer.fnl index a2fdd3f..d9ca89c 100644 --- a/src/fennel-ls/analyzer.fnl +++ b/src/fennel-ls/analyzer.fnl @@ -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) diff --git a/test/lint.fnl b/test/lint.fnl index 9df4b06..73741a8 100644 --- a/test/lint.fnl +++ b/test/lint.fnl @@ -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 []