mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Merge pull request #832 from mjbvz/inline-fix
Fix exception when trying to use negative line numbers
This commit is contained in:
@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user