Skip to content

Commit

Permalink
add jest coverage for Diagnostic pane feature
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed Oct 26, 2021
1 parent 33e5077 commit c624907
Show file tree
Hide file tree
Showing 3 changed files with 441 additions and 38 deletions.
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type ExtensionConfig = {
additionalUnicodeChars?: string[],
allowedUnicodeChars?: string[],
asciiOnly?: boolean,
severity?: number,
};

function loadConfiguration(): {
Expand Down Expand Up @@ -91,7 +92,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.workspace.onDidCloseTextDocument(event => {
diagnosticCollection.delete(event.uri);
triggerUpdateDecorations();
})
}, null, context.subscriptions);

function triggerUpdateDecorations() {
if (timeout) {
Expand Down Expand Up @@ -130,8 +131,8 @@ export function activate(context: vscode.ExtensionContext) {
startPos,
endPos,
`found a bad character: \\u${codePoint} (${match[0]})`,
config.errorSeverity
)
config.errorSeverity,
),
);
}
activeEditor.setDecorations(config.badCharDecorationType, badChars);
Expand All @@ -142,7 +143,7 @@ export function activate(context: vscode.ExtensionContext) {
start: vscode.Position,
end: vscode.Position,
message: string,
severity: vscode.DiagnosticSeverity
severity: vscode.DiagnosticSeverity,
) {
const diagnostic = new vscode.Diagnostic(new vscode.Range(start, end), message, severity);
diagnostic.source = 'highlight-bad-chars';
Expand Down
Loading

0 comments on commit c624907

Please sign in to comment.