Fix Line Lengths
This commit is contained in:
parent
ace85c8841
commit
867198590f
@ -44,7 +44,7 @@ function _handleContextChange(editor: TextEditor): void {
|
|||||||
if (!editor || !editor.document) {
|
if (!editor || !editor.document) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (editor.document.languageId) {
|
switch (editor.document.languageId) {
|
||||||
case "xquery":
|
case "xquery":
|
||||||
languages.createDiagnosticCollection("XQueryDiagnostics").set(editor.document.uri, new XQueryLinter().lint(editor.document.getText()));
|
languages.createDiagnosticCollection("XQueryDiagnostics").set(editor.document.uri, new XQueryLinter().lint(editor.document.getText()));
|
||||||
|
@ -3,19 +3,33 @@ import { Diagnostic, DiagnosticSeverity, Position, Range } from "vscode";
|
|||||||
const XQLint = require("xqlint").XQLint;
|
const XQLint = require("xqlint").XQLint;
|
||||||
|
|
||||||
export class XQueryLinter {
|
export class XQueryLinter {
|
||||||
static SEVERITY_WARNING: number = 1;
|
static SEVERITY_WARNING = 1;
|
||||||
static SEVERITY_ERROR: number = 2;
|
static SEVERITY_ERROR = 2;
|
||||||
|
|
||||||
lint(text: string): Diagnostic[] {
|
lint(text: string): Diagnostic[] {
|
||||||
const linter = new XQLint(text);
|
const linter = new XQLint(text);
|
||||||
const diagnostics = new Array<Diagnostic>();
|
const diagnostics = new Array<Diagnostic>();
|
||||||
|
|
||||||
linter.getErrors().forEach((error: any) => {
|
linter.getErrors().forEach((error: any) => {
|
||||||
diagnostics.push(new Diagnostic(new Range(new Position(error.pos.sl, error.pos.sc), new Position(error.pos.el, error.pos.ec)), error.message, DiagnosticSeverity.Error));
|
diagnostics.push(new Diagnostic(
|
||||||
|
new Range(
|
||||||
|
new Position(error.pos.sl, error.pos.sc),
|
||||||
|
new Position(error.pos.el, error.pos.ec)
|
||||||
|
),
|
||||||
|
error.message,
|
||||||
|
DiagnosticSeverity.Error
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
linter.getWarnings().forEach((warning: any) => {
|
linter.getWarnings().forEach((warning: any) => {
|
||||||
diagnostics.push(new Diagnostic(new Range(new Position(warning.pos.sl, warning.pos.sc), new Position(warning.pos.el, warning.pos.ec)), warning.message, DiagnosticSeverity.Warning));
|
diagnostics.push(new Diagnostic(
|
||||||
|
new Range(
|
||||||
|
new Position(warning.pos.sl, warning.pos.sc),
|
||||||
|
new Position(warning.pos.el, warning.pos.ec)
|
||||||
|
),
|
||||||
|
warning.message,
|
||||||
|
DiagnosticSeverity.Warning
|
||||||
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
return diagnostics;
|
return diagnostics;
|
||||||
|
Loading…
Reference in New Issue
Block a user