Skip to content

Commit 506b41e

Browse files
committed
Fix vscode config generation
1 parent 9741233 commit 506b41e

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,28 +107,28 @@ pluginsToVSCodeExtensionSchema IdePlugins {..} = A.object $ mconcat $ singlePlug
107107
(PluginId pId) = pluginId
108108
genericSchema =
109109
let x =
110-
[toKey' "diagnosticsOn" A..= schemaEntry "diagnostics" | configHasDiagnostics]
111-
<> nubOrd (mconcat (handlersToGenericSchema <$> handlers))
110+
[toKey' "diagnosticsOn" A..= schemaEntry "diagnostics" True | configHasDiagnostics]
111+
<> nubOrd (mconcat (handlersToGenericSchema configInitialGenericConfig <$> handlers))
112112
in case x of
113113
-- If the plugin has only one capability, we produce globalOn instead of the specific one;
114114
-- otherwise we don't produce globalOn at all
115-
[_] -> [toKey' "globalOn" A..= schemaEntry "plugin"]
115+
[_] -> [toKey' "globalOn" A..= schemaEntry "plugin" (plcGlobalOn configInitialGenericConfig)]
116116
_ -> x
117117
dedicatedSchema = customConfigToDedicatedSchema configCustomConfig
118-
handlersToGenericSchema (IdeMethod m DSum.:=> _) = case m of
119-
SMethod_TextDocumentCodeAction -> [toKey' "codeActionsOn" A..= schemaEntry "code actions"]
120-
SMethod_TextDocumentCodeLens -> [toKey' "codeLensOn" A..= schemaEntry "code lenses"]
121-
SMethod_TextDocumentRename -> [toKey' "renameOn" A..= schemaEntry "rename"]
122-
SMethod_TextDocumentHover -> [toKey' "hoverOn" A..= schemaEntry "hover"]
123-
SMethod_TextDocumentDocumentSymbol -> [toKey' "symbolsOn" A..= schemaEntry "symbols"]
124-
SMethod_TextDocumentCompletion -> [toKey' "completionOn" A..= schemaEntry "completions"]
125-
SMethod_TextDocumentPrepareCallHierarchy -> [toKey' "callHierarchyOn" A..= schemaEntry "call hierarchy"]
126-
_ -> []
127-
schemaEntry desc =
118+
handlersToGenericSchema PluginConfig{..} (IdeMethod m DSum.:=> _) = case m of
119+
SMethod_TextDocumentCodeAction -> [toKey' "codeActionsOn" A..= schemaEntry "code actions" plcCodeActionsOn]
120+
SMethod_TextDocumentCodeLens -> [toKey' "codeLensOn" A..= schemaEntry "code lenses" plcCodeLensOn]
121+
SMethod_TextDocumentRename -> [toKey' "renameOn" A..= schemaEntry "rename" plcRenameOn]
122+
SMethod_TextDocumentHover -> [toKey' "hoverOn" A..= schemaEntry "hover" plcHoverOn]
123+
SMethod_TextDocumentDocumentSymbol -> [toKey' "symbolsOn" A..= schemaEntry "symbols" plcSymbolsOn]
124+
SMethod_TextDocumentCompletion -> [toKey' "completionOn" A..= schemaEntry "completions" plcCompletionOn]
125+
SMethod_TextDocumentPrepareCallHierarchy -> [toKey' "callHierarchyOn" A..= schemaEntry "call hierarchy" plcCallHierarchyOn]
126+
_ -> []
127+
schemaEntry desc defaultVal =
128128
A.object
129129
[ "scope" A..= A.String "resource",
130130
"type" A..= A.String "boolean",
131-
"default" A..= True,
131+
"default" A..= A.Bool defaultVal,
132132
"description" A..= A.String ("Enables " <> pId <> " " <> desc)
133133
]
134134
withIdPrefix x = "haskell.plugin." <> pId <> "." <> x

test/testdata/schema/ghc94/vscode-extension-schema.golden.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
"type": "boolean"
257257
},
258258
"haskell.plugin.stan.globalOn": {
259-
"default": true,
259+
"default": false,
260260
"description": "Enables stan plugin",
261261
"scope": "resource",
262262
"type": "boolean"

test/testdata/schema/ghc96/vscode-extension-schema.golden.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
"type": "boolean"
257257
},
258258
"haskell.plugin.stan.globalOn": {
259-
"default": true,
259+
"default": false,
260260
"description": "Enables stan plugin",
261261
"scope": "resource",
262262
"type": "boolean"

test/testdata/schema/ghc98/vscode-extension-schema.golden.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
"type": "boolean"
173173
},
174174
"haskell.plugin.stan.globalOn": {
175-
"default": true,
175+
"default": false,
176176
"description": "Enables stan plugin",
177177
"scope": "resource",
178178
"type": "boolean"

0 commit comments

Comments
 (0)