From 284a760224421a50ac7130ccd7c8db5ea966d86e Mon Sep 17 00:00:00 2001 From: XeroOl Date: Fri, 18 Jul 2025 12:45:48 -0500 Subject: [PATCH] fix the `|` virtual cursor character appearing in completion output --- src/fennel-ls/completion.fnl | 3 ++- test/completion.fnl | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fennel-ls/completion.fnl b/src/fennel-ls/completion.fnl index 26006c5..fa37610 100644 --- a/src/fennel-ls/completion.fnl +++ b/src/fennel-ls/completion.fnl @@ -62,7 +62,8 @@ is set to true and we report that we support completionItem/resolve." seen {}] (fn add-completion! [name definition ?kind] - (table.insert results (format.completion-item-format server name definition range ?kind))) + (when (and symbol (not= name (tostring symbol))) + (table.insert results (format.completion-item-format server name definition range ?kind)))) (fn add-completion-recursively! [name definition] "add the completion. also recursively adds the fields' completions" diff --git a/test/completion.fnl b/test/completion.fnl index d45ae91..a4cf817 100644 --- a/test/completion.fnl +++ b/test/completion.fnl @@ -290,15 +290,22 @@ nil) (fn test-no-completion [] + ;; comment (check "; (" [] [:math]) + ;; inside of a string (check "\" (|\n\"" [] [:math]) + ;; inside of a string, but the starting quote is on a different line (check "\"\n(|\"" [] [:math]) + + (check "(fn foo|)" + [] + ["foo|"]) nil) ;; ;; Future tests / features