From 67c7f7f4b7db7c245030307096f6a7caf22ae87d Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Sun, 16 Feb 2025 13:21:45 +0100 Subject: [PATCH] feat(server): Add NoTypoSuggestions to global options --- server/common/options.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/common/options.go b/server/common/options.go index 35773e0..8dc762d 100644 --- a/server/common/options.go +++ b/server/common/options.go @@ -13,6 +13,15 @@ type ServerOptionsType struct { // we show a native warning. The error message boxes just clutter // the interface. NoUndetectableErrors bool + + // If true, the server will not detect typos and suggest + // the correct keywords. + // Since the server finds typos using the Damerau-Levenshtein distance, + // and this is done each time code actions are requested + // (which happens quite often), these suggestions can eat a lot of resources. + // You may want to enable this option if you are dealing with little + // resources or if you're low on battery. + NoTypoSuggestions bool } var ServerOptions = new(ServerOptionsType) @@ -22,4 +31,9 @@ func InitServerOptions() { Log.Info("config-lsp will not return errors for undetectable files") ServerOptions.NoUndetectableErrors = true } + + if slices.Contains(os.Args, "--no-typo-suggestions") { + Log.Info("config-lsp will not detect typos for keywords") + ServerOptions.NoTypoSuggestions = true + } }