[mod] release 0.5.2
This commit is contained in:
parent
cfc8ba3817
commit
47baf6f2b9
13 changed files with 243 additions and 66 deletions
23
src/linting/getAST.ts
Normal file
23
src/linting/getAST.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
import { Range, TextEditor, Selection } from "vscode";
|
||||
import { channel } from "../common/logger";
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const XQLint = require("@quodatum/xqlint").XQLint;
|
||||
|
||||
export function getAst(textEditor: TextEditor): void {
|
||||
textEditor.edit(textEdit => {
|
||||
const selections = textEditor.selections;
|
||||
selections.forEach(selection => {
|
||||
if (selection.isEmpty) {
|
||||
selection = new Selection(
|
||||
textEditor.document.positionAt(0),
|
||||
textEditor.document.positionAt(textEditor.document.getText().length)
|
||||
);
|
||||
}
|
||||
const text = textEditor.document.getText(new Range(selection.start, selection.end));
|
||||
const linter = new XQLint(text);
|
||||
const ast=linter.getAST();
|
||||
channel.appendLine(ast);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -1 +1,2 @@
|
|||
export * from "./xquery-linter";
|
||||
export * from "./getAST";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue