mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 09:08:46 +00:00
Use test instead of match
This commit is contained in:
parent
035963b1f1
commit
2a46387970
1 changed files with 2 additions and 2 deletions
|
@ -81,13 +81,13 @@ class JsDocCompletionProvider implements vscode.CompletionItemProvider {
|
||||||
// or could be the opening of a comment
|
// or could be the opening of a comment
|
||||||
const line = document.lineAt(position.line).text;
|
const line = document.lineAt(position.line).text;
|
||||||
const prefix = line.slice(0, position.character);
|
const prefix = line.slice(0, position.character);
|
||||||
if (prefix.match(/^\s*$|\/\*\*\s*$|^\s*\/\*\*+\s*$/) === null) {
|
if (!/^\s*$|\/\*\*\s*$|^\s*\/\*\*+\s*$/.test(prefix)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// And everything after is possibly a closing comment or more whitespace
|
// And everything after is possibly a closing comment or more whitespace
|
||||||
const suffix = line.slice(position.character);
|
const suffix = line.slice(position.character);
|
||||||
return suffix.match(/^\s*\*+\//) !== null;
|
return /^\s*(\*+\/)?\s*$/.test(suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue