Skip to content

Commit

Permalink
Fix Cannot read properties of undefined (reading 'stoppedEarly') on…
Browse files Browse the repository at this point in the history
… single line files #10
  • Loading branch information
RedCMD committed Jun 14, 2024
1 parent 85dadd8 commit 1ffb1a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Providers/TreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export const TreeDataProvider: vscode.TreeDataProvider<element> = {
else
return elements;
}
if (id < 0) {
id = 0;
}

for (let index = id; index < grammar.rules.length; index++) {
const matchResult = grammar.rules[index];
Expand Down Expand Up @@ -904,9 +907,9 @@ async function gotoFile(element: element) {
const end = rule.captureIndices[0].end;
const location = new vscode.Location(
document.uri,
new vscode.Range(line - 1, start, line - 1, end),
new vscode.Range(line, start, line, end),
);
const position = new vscode.Position(line - 1, start);
const position = new vscode.Position(line, start);
vscode.commands.executeCommand('editor.action.goToLocations', document.uri, position, [location]);
return;
}
Expand Down

0 comments on commit 1ffb1a1

Please sign in to comment.