Fix for #218
This commit is contained in:
parent
84adff578f
commit
86f20698b3
@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
commands, languages, window, workspace, ExtensionContext, Memento,
|
commands, languages, window, workspace, ExtensionContext, Memento,
|
||||||
TextEditor, TextEditorSelectionChangeEvent, TextEditorSelectionChangeKind
|
TextEditor, TextEditorSelectionChangeEvent, TextEditorSelectionChangeKind, DiagnosticCollection
|
||||||
} from "vscode";
|
} from "vscode";
|
||||||
|
|
||||||
import { createDocumentSelector, ExtensionState, Configuration } from "./common";
|
import { createDocumentSelector, ExtensionState, Configuration } from "./common";
|
||||||
@ -14,6 +14,8 @@ import { executeXQuery } from "./xquery-execution/commands";
|
|||||||
|
|
||||||
import * as constants from "./constants";
|
import * as constants from "./constants";
|
||||||
|
|
||||||
|
let diagnosticCollectionXQuery: DiagnosticCollection;
|
||||||
|
|
||||||
export function activate(context: ExtensionContext) {
|
export function activate(context: ExtensionContext) {
|
||||||
ExtensionState.configure(context);
|
ExtensionState.configure(context);
|
||||||
|
|
||||||
@ -36,7 +38,9 @@ export function activate(context: ExtensionContext) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* Linting Features */
|
/* Linting Features */
|
||||||
|
diagnosticCollectionXQuery = languages.createDiagnosticCollection(constants.diagnosticCollections.xquery);
|
||||||
context.subscriptions.push(
|
context.subscriptions.push(
|
||||||
|
diagnosticCollectionXQuery,
|
||||||
window.onDidChangeActiveTextEditor(_handleChangeActiveTextEditor),
|
window.onDidChangeActiveTextEditor(_handleChangeActiveTextEditor),
|
||||||
window.onDidChangeTextEditorSelection(_handleChangeTextEditorSelection)
|
window.onDidChangeTextEditorSelection(_handleChangeTextEditorSelection)
|
||||||
);
|
);
|
||||||
@ -85,9 +89,7 @@ function _handleContextChange(editor: TextEditor): void {
|
|||||||
|
|
||||||
switch (editor.document.languageId) {
|
switch (editor.document.languageId) {
|
||||||
case constants.languageIds.xquery:
|
case constants.languageIds.xquery:
|
||||||
languages
|
diagnosticCollectionXQuery.set(editor.document.uri, new XQueryLinter().lint(editor.document.getText()));
|
||||||
.createDiagnosticCollection(constants.diagnosticCollections.xquery)
|
|
||||||
.set(editor.document.uri, new XQueryLinter().lint(editor.document.getText()));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user