Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Snippets can't be disabled #1422

Closed
@maksbotan

Description

@maksbotan

I would like to disable snippets on completion entirely, because it's far often more annoying than helpful, but I can't find a way to do that.

If I set "completionSnippetsOn": "false", it seems to have no effect --- I still get all fields for my records, for example.

I tried disabling this explicitly in the code, in

snippets <- Completions.WithSnippets <$> configVal completionSnippetsOn
and
| withSnippets && supportsSnippets = x
like this:

diff --git a/src/Haskell/Ide/Engine/Transport/LspStdio.hs b/src/Haskell/Ide/Engine/Transport/LspStdio.hs
index 5b57a847..945a7516 100644
--- a/src/Haskell/Ide/Engine/Transport/LspStdio.hs
+++ b/src/Haskell/Ide/Engine/Transport/LspStdio.hs
@@ -641,7 +641,7 @@ reactor inp diagIn = do
           case mprefix of
             Nothing -> callback []
             Just prefix -> do
-              snippets <- Completions.WithSnippets <$> configVal completionSnippetsOn
+              snippets <- Completions.WithSnippets <$> return False{-configVal completionSnippetsOn-}
diff --git a/src/Haskell/Ide/Engine/LSP/Completions.hs b/src/Haskell/Ide/Engine/LSP/Completions.hs
index 1fba462d..58c4cedd 100644
--- a/src/Haskell/Ide/Engine/LSP/Completions.hs
+++ b/src/Haskell/Ide/Engine/LSP/Completions.hs
@@ -296,7 +296,7 @@ newtype WithSnippets = WithSnippets Bool
 
 -- | Returns the cached completions for the given module and position.
 getCompletions :: Uri -> VFS.PosPrefixInfo -> WithSnippets -> IdeM (IdeResult [J.CompletionItem])
-getCompletions uri prefixInfo (WithSnippets withSnippets) =
+getCompletions uri prefixInfo (WithSnippets _withSnippets) =
   pluginGetFile "getCompletions: " uri $ \file -> do
     let snippetLens = (^? J.textDocument
                         . _Just
@@ -306,9 +306,9 @@ getCompletions uri prefixInfo (WithSnippets withSnippets) =
                         . _Just
                         . J.snippetSupport
                         . _Just)
-    supportsSnippets <- fromMaybe False . snippetLens <$> getClientCapabilities
+    _supportsSnippets <- fromMaybe False . snippetLens <$> getClientCapabilities
     let toggleSnippets x
-          | withSnippets && supportsSnippets = x
+          | False = x
           | otherwise = x { J._insertTextFormat = Just J.PlainText
                           , J._insertText       = Nothing
                           }

But this had no effect as well.

Can you please provide a way to disable this feature?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions