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