diff --git a/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs b/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs index da2751106c..9c1c592fd2 100644 --- a/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs +++ b/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs @@ -108,29 +108,29 @@ pluginsToVSCodeExtensionSchema IdePlugins {..} = A.object $ mconcat $ singlePlug (PluginId pId) = pluginId genericSchema = let x = - [toKey' "diagnosticsOn" A..= schemaEntry "diagnostics" | configHasDiagnostics] - <> nubOrd (mconcat (handlersToGenericSchema <$> handlers)) + [toKey' "diagnosticsOn" A..= schemaEntry "diagnostics" True | configHasDiagnostics] + <> nubOrd (mconcat (handlersToGenericSchema configInitialGenericConfig <$> handlers)) in case x of -- If the plugin has only one capability, we produce globalOn instead of the specific one; -- otherwise we don't produce globalOn at all - [_] -> [toKey' "globalOn" A..= schemaEntry "plugin"] + [_] -> [toKey' "globalOn" A..= schemaEntry "plugin" (plcGlobalOn configInitialGenericConfig)] _ -> x dedicatedSchema = customConfigToDedicatedSchema configCustomConfig - handlersToGenericSchema (IdeMethod m DSum.:=> _) = case m of - SMethod_TextDocumentCodeAction -> [toKey' "codeActionsOn" A..= schemaEntry "code actions"] - SMethod_TextDocumentCodeLens -> [toKey' "codeLensOn" A..= schemaEntry "code lenses"] - SMethod_TextDocumentRename -> [toKey' "renameOn" A..= schemaEntry "rename"] - SMethod_TextDocumentHover -> [toKey' "hoverOn" A..= schemaEntry "hover"] - SMethod_TextDocumentDocumentSymbol -> [toKey' "symbolsOn" A..= schemaEntry "symbols"] - SMethod_TextDocumentCompletion -> [toKey' "completionOn" A..= schemaEntry "completions"] - SMethod_TextDocumentPrepareCallHierarchy -> [toKey' "callHierarchyOn" A..= schemaEntry "call hierarchy"] - SMethod_TextDocumentSemanticTokensFull -> [toKey' "semanticTokensOn" A..= schemaEntry "semantic tokens"] - _ -> [] - schemaEntry desc = + handlersToGenericSchema PluginConfig{..} (IdeMethod m DSum.:=> _) = case m of + SMethod_TextDocumentCodeAction -> [toKey' "codeActionsOn" A..= schemaEntry "code actions" plcCodeActionsOn] + SMethod_TextDocumentCodeLens -> [toKey' "codeLensOn" A..= schemaEntry "code lenses" plcCodeLensOn] + SMethod_TextDocumentRename -> [toKey' "renameOn" A..= schemaEntry "rename" plcRenameOn] + SMethod_TextDocumentHover -> [toKey' "hoverOn" A..= schemaEntry "hover" plcHoverOn] + SMethod_TextDocumentDocumentSymbol -> [toKey' "symbolsOn" A..= schemaEntry "symbols" plcSymbolsOn] + SMethod_TextDocumentCompletion -> [toKey' "completionOn" A..= schemaEntry "completions" plcCompletionOn] + SMethod_TextDocumentPrepareCallHierarchy -> [toKey' "callHierarchyOn" A..= schemaEntry "call hierarchy" plcCallHierarchyOn] + SMethod_TextDocumentSemanticTokensFull -> [toKey' "semanticTokensOn" A..= schemaEntry "semantic tokens" plcSemanticTokensOn] + _ -> [] + schemaEntry desc defaultVal = A.object [ "scope" A..= A.String "resource", "type" A..= A.String "boolean", - "default" A..= True, + "default" A..= A.Bool defaultVal, "description" A..= A.String ("Enables " <> pId <> " " <> desc) ] withIdPrefix x = "haskell.plugin." <> pId <> "." <> x diff --git a/test/testdata/schema/ghc92/vscode-extension-schema.golden.json b/test/testdata/schema/ghc92/vscode-extension-schema.golden.json index d7e3623ed1..01c36f1562 100644 --- a/test/testdata/schema/ghc92/vscode-extension-schema.golden.json +++ b/test/testdata/schema/ghc92/vscode-extension-schema.golden.json @@ -250,7 +250,7 @@ "type": "boolean" }, "haskell.plugin.semanticTokens.globalOn": { - "default": true, + "default": false, "description": "Enables semanticTokens plugin", "scope": "resource", "type": "boolean" diff --git a/test/testdata/schema/ghc94/vscode-extension-schema.golden.json b/test/testdata/schema/ghc94/vscode-extension-schema.golden.json index f9e00d2f18..349b07571d 100644 --- a/test/testdata/schema/ghc94/vscode-extension-schema.golden.json +++ b/test/testdata/schema/ghc94/vscode-extension-schema.golden.json @@ -250,7 +250,7 @@ "type": "boolean" }, "haskell.plugin.semanticTokens.globalOn": { - "default": true, + "default": false, "description": "Enables semanticTokens plugin", "scope": "resource", "type": "boolean" @@ -262,7 +262,7 @@ "type": "boolean" }, "haskell.plugin.stan.globalOn": { - "default": true, + "default": false, "description": "Enables stan plugin", "scope": "resource", "type": "boolean" diff --git a/test/testdata/schema/ghc96/vscode-extension-schema.golden.json b/test/testdata/schema/ghc96/vscode-extension-schema.golden.json index f9e00d2f18..349b07571d 100644 --- a/test/testdata/schema/ghc96/vscode-extension-schema.golden.json +++ b/test/testdata/schema/ghc96/vscode-extension-schema.golden.json @@ -250,7 +250,7 @@ "type": "boolean" }, "haskell.plugin.semanticTokens.globalOn": { - "default": true, + "default": false, "description": "Enables semanticTokens plugin", "scope": "resource", "type": "boolean" @@ -262,7 +262,7 @@ "type": "boolean" }, "haskell.plugin.stan.globalOn": { - "default": true, + "default": false, "description": "Enables stan plugin", "scope": "resource", "type": "boolean" diff --git a/test/testdata/schema/ghc98/vscode-extension-schema.golden.json b/test/testdata/schema/ghc98/vscode-extension-schema.golden.json index 5073a3e339..b01b0f0189 100644 --- a/test/testdata/schema/ghc98/vscode-extension-schema.golden.json +++ b/test/testdata/schema/ghc98/vscode-extension-schema.golden.json @@ -172,13 +172,13 @@ "type": "boolean" }, "haskell.plugin.semanticTokens.globalOn": { - "default": true, + "default": false, "description": "Enables semanticTokens plugin", "scope": "resource", "type": "boolean" }, "haskell.plugin.stan.globalOn": { - "default": true, + "default": false, "description": "Enables stan plugin", "scope": "resource", "type": "boolean"