From 40605c7bcbc7fbe601efd99bd98194a43363d06f Mon Sep 17 00:00:00 2001 From: XeroOl Date: Sun, 7 Apr 2024 23:26:17 -0500 Subject: [PATCH] fix: Choose positionEncoding=utf-8 even if it isn't listed last --- src/fennel-ls/state.fnl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/fennel-ls/state.fnl b/src/fennel-ls/state.fnl index 555a2f9..7e16b8a 100644 --- a/src/fennel-ls/state.fnl +++ b/src/fennel-ls/state.fnl @@ -110,13 +110,14 @@ entire fennel-ls project is referring to the same object." (make-configuration-from-template default-configuration ?c)) (λ choose-position-encoding [init-params] - "fennel-ls natively uses utf-8, so ideally we will choose positionEncoding=utf-8. -However, fennel-ls can fall back to positionEncoding=utf-16 (with a performance hit)." + "fennel-ls natively uses utf-8, so the goal is to choose positionEncoding=\"utf-8\". +However, when not an option, fennel-ls will fall back to positionEncoding=\"utf-16\" (with a performance hit)." (let [?position-encodings (?. init-params :capabilities :general :positionEncodings) utf8? (if (= (type ?position-encodings) :table) - (accumulate [_utf-8? false - _ encoding (ipairs ?position-encodings)] + (accumulate [utf-8? false + _ encoding (ipairs ?position-encodings) + &until utf-8?] (or (= encoding :utf-8) (= encoding :utf8))) false)]