Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added:

- Diagnostics: Ensure at least one plugin is enabled
- Diagnostics: Information added to pluginName value when plugin can be configured with a configSection

### Changed:

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following sections describe the features that the extension contributes to V
- Check that schema matches installed version of Dev Proxy
- Check that reporters are placed after plugins
- Check that at least one plugin is enabled
- Check that a plugin can be configured with a configSection

### Editor Actions

Expand Down
15 changes: 15 additions & 0 deletions src/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ const checkPluginConfiguration = (pluginNode: parse.ObjectNode, diagnostics: vsc
: vscode.DiagnosticSeverity.Warning
)
);
} else if (pluginSnippet.config?.required === false) {
const pluginNameNode = getASTNode(
pluginNode.children,
'Identifier',
'name'
);
if (pluginNameNode) {
diagnostics.push(
new vscode.Diagnostic(
getRangeFromASTNode(pluginNameNode.value),
`${pluginName} can be configured with a configSection. Use '${pluginSnippet.config?.name}' snippet to create one.`,
vscode.DiagnosticSeverity.Information
)
);
}
}
} else {
// if there is a config section defined on the plugin, we should have the config section defined in the document
Expand Down
6 changes: 4 additions & 2 deletions src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,10 @@ suite('schema', () => {
await sleep(1000);
const diagnostics = vscode.languages.getDiagnostics(document.uri);

const expected = 0;
const actual = diagnostics.length;
const expected = false;
const actual = diagnostics.some((diagnostic) => {
return diagnostic.severity === vscode.DiagnosticSeverity.Warning;
});
assert.deepStrictEqual(actual, expected);
});

Expand Down
Loading