Merge pull request #832 from mjbvz/inline-fix

Fix exception when trying to use negative line numbers
This commit is contained in:
Matt Bierner
2023-03-09 14:11:42 -08:00
committed by GitHub

View File

@ -22,9 +22,13 @@ export function activate(context: vscode.ExtensionContext) {
let offset = 1;
while (offset > 0) {
if (position.line - offset < 0) {
break;
}
const lineBefore = document.lineAt(position.line - offset).text;
const matches = lineBefore.match(regexp);
if (!matches || position.line - offset < 0) {
if (!matches) {
break;
}
offset++;