Skip to content

Commit 8606fc1

Browse files
committed
Show warnings instead of errors when plugin is disabled
Closes #8
1 parent 022fd7b commit 8606fc1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/extension.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ const updateDiagnostics = (
106106
);
107107
const pluginName = (pluginNameNode?.value as parse.LiteralNode)
108108
.value as string;
109+
const enabledNode = getASTNode(
110+
pluginNode.children,
111+
'Identifier',
112+
'enabled'
113+
);
114+
const isEnabled = (enabledNode?.value as parse.LiteralNode).value as boolean;
109115
const pluginSnippet = pluginSnippets[pluginName];
110116
const requiresConfig = pluginSnippet.config ? pluginSnippet.config.required : false;
111117

@@ -141,7 +147,7 @@ const updateDiagnostics = (
141147
new vscode.Diagnostic(
142148
getRangeFromASTNode(configSectionNode.value),
143149
`${configSectionName} config section is missing. Use '${pluginSnippet.config?.name}' snippet to create one.`,
144-
vscode.DiagnosticSeverity.Error
150+
isEnabled ? vscode.DiagnosticSeverity.Error : vscode.DiagnosticSeverity.Warning
145151
)
146152
);
147153
}

0 commit comments

Comments
 (0)