mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 07:55:56 +03:00
Fixed regular expression for # type: ignore
and # pyright: ignore
comments. This addresses #8000.
This commit is contained in:
parent
c1b5bccca0
commit
a4d165ec02
@ -1280,7 +1280,7 @@ export class Tokenizer {
|
||||
const length = this._cs.position - start;
|
||||
const comment = Comment.create(start, length, this._cs.getText().slice(start, start + length));
|
||||
|
||||
const typeIgnoreRegexMatch = comment.value.match(/((^|#)\s*)type:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);
|
||||
const typeIgnoreRegexMatch = comment.value.match(/((^|#)\s*)type:\s*ignore(\s*\[([\s\w-,]*)\]|\s|$)/);
|
||||
if (typeIgnoreRegexMatch) {
|
||||
const commentStart = start + (typeIgnoreRegexMatch.index ?? 0);
|
||||
const textRange: TextRange = {
|
||||
@ -1299,7 +1299,7 @@ export class Tokenizer {
|
||||
}
|
||||
}
|
||||
|
||||
const pyrightIgnoreRegexMatch = comment.value.match(/((^|#)\s*)pyright:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);
|
||||
const pyrightIgnoreRegexMatch = comment.value.match(/((^|#)\s*)pyright:\s*ignore(\s*\[([\s\w-,]*)\]|\s|$)/);
|
||||
if (pyrightIgnoreRegexMatch) {
|
||||
const commentStart = start + (pyrightIgnoreRegexMatch.index ?? 0);
|
||||
const textRange: TextRange = {
|
||||
|
Loading…
Reference in New Issue
Block a user