From 3dc9e36af661ace85eb2becafbca6e872e24775d Mon Sep 17 00:00:00 2001 From: XeroOl Date: Tue, 14 May 2024 00:46:10 -0500 Subject: [PATCH] workaround for fennel#221 --- src/fennel-ls/compiler.fnl | 3 ++- test/misc.fnl | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fennel-ls/compiler.fnl b/src/fennel-ls/compiler.fnl index 19af932..ee411bf 100644 --- a/src/fennel-ls/compiler.fnl +++ b/src/fennel-ls/compiler.fnl @@ -343,7 +343,8 @@ identifiers are declared / referenced in which places." (λ parsed [ast] "runs on every ast tree that was parsed" - (if (sym? ast) + ;; TODO in fennel 1.5+, bug fennel#221 will be fixed, and all syms in the ast should have a bytestart + (if (and (sym? ast) ast.bytestart) (case (values (tostring ast) (file.text:sub ast.bytestart ast.bytestart)) (where (:hashfn "#")) (table.insert defer #(set ast.byteend ast.bytestart)) diff --git a/test/misc.fnl b/test/misc.fnl index 6a7ee81..9fd6b70 100644 --- a/test/misc.fnl +++ b/test/misc.fnl @@ -39,6 +39,7 @@ (create-client-with-files "(macro foo {} nil) (λ test {} nil) (λ {} nil") + (create-client-with-files "(fn foo []\n #\n (print :test))") nil) (fn test-split-spaces []