From 7f8942fde61b14ce501d6f493ba4924ef63cb68d Mon Sep 17 00:00:00 2001 From: XeroOl Date: Sat, 27 May 2023 21:10:49 -0500 Subject: [PATCH] Support completions of x: symbols --- fennel | 2 +- src/fennel.lua | 2 +- test/completion-test.fnl | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fennel b/fennel index e364a16..46cce58 100755 --- a/fennel +++ b/fennel @@ -5117,7 +5117,7 @@ package.preload["fennel.utils"] = package.preload["fennel.utils"] or function(.. end return ((0 < #parts) and parts) end - return ((str:match("%.") or str:match(":")) and not str:match("%.%.") and (str:byte() ~= string.byte(".")) and (str:byte(( - 1)) ~= string.byte(".")) and _154_()) + return ((str:match("%.") or str:match(":")) and not str:match("%.%.") and (str:byte() ~= string.byte(".")) and (str:byte(-1) ~= string.byte(".")) and (str:byte() ~= string.byte(":")) and (str:byte(-1) ~= string.byte(":")) and _154_()) end end local function quoted_3f(symbol) diff --git a/src/fennel.lua b/src/fennel.lua index ac75b59..98b1b11 100644 --- a/src/fennel.lua +++ b/src/fennel.lua @@ -4919,7 +4919,7 @@ package.preload["fennel.utils"] = package.preload["fennel.utils"] or function(.. end return ((0 < #parts) and parts) end - return ((str:match("%.") or str:match(":")) and not str:match("%.%.") and (str:byte() ~= string.byte(".")) and (str:byte(( - 1)) ~= string.byte(".")) and _154_()) + return ((str:match("%.") or str:match(":")) and not str:match("%.%.") and (str:byte() ~= string.byte(".")) and (str:byte(-1) ~= string.byte(".")) and (str:byte() ~= string.byte(":")) and (str:byte(-1) ~= string.byte(":")) and _154_()) end end local function quoted_3f(symbol) diff --git a/test/completion-test.fnl b/test/completion-test.fnl index b213b54..f19f69f 100644 --- a/test/completion-test.fnl +++ b/test/completion-test.fnl @@ -70,8 +70,8 @@ (it "still completes items from the previous definitions in the same `let`" (check-completion "(let [a 10\n b 20\n " 1 6 [:a :b])) - ;; (it "completes fields with a partially typed multisym that ends in :" - ;; (check-completion "(local x {:field (fn [])})\n(x:" 1 3 [:field])) + (it "completes fields with a partially typed multisym that ends in :" + (check-completion "(local x {:field (fn [])})\n(x:" 1 3 [:field])) (it "doesn't crash with a partially typed multisym contains ::" (check-no-completion "(local x {:field (fn [])})\n(x::f" 1 3 [:field])))