Skip to content

Commit

Permalink
Improve Regex TreeSitter missing errors performance
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCMD committed Sep 3, 2024
1 parent 15bb335 commit d67ef08
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/DiagnosticCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,18 @@ function Diagnostics(document: vscode.TextDocument, Diagnostics: vscode.Diagnost

if (true) { // TreeSitter Regex errors
// vscode.window.showInformationMessage(JSON.stringify("diagnostics Regex"));
// const start = performance.now();
const regexTrees = trees.regexTrees;
for (const id in regexTrees) {
const tree = regexTrees[id];
// vscode.window.showInformationMessage(JSON.stringify(tree.rootNode.toString()));

const queryString = `
const queryString = `;scm
(ERROR) @ERROR
(error) @error
(quantifier) @quantifier
(character_property_name) @property
_ @missing ;Only the last child node can be missing
(_ _ @missing (#eq? @missing ""))
`;
const queryCaptures = queryNode(tree.rootNode, queryString);

Expand Down Expand Up @@ -281,6 +282,7 @@ function Diagnostics(document: vscode.TextDocument, Diagnostics: vscode.Diagnost
// vscode.window.showInformationMessage(JSON.stringify(diagnostic));
}
}
// vscode.window.showInformationMessage(performance.now() - start + "ms");
}

if (true) { // Oniguruma Regex errors. https://github.com/kkos/oniguruma
Expand Down

0 comments on commit d67ef08

Please sign in to comment.