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