提交 0fbbc8eb 编写于 作者: J Johannes Rieken

fix #27245

上级 01e289ea
......@@ -201,7 +201,9 @@ declare module 'vscode' {
* Get a word-range at the given position. By default words are defined by
* common separators, like space, -, _, etc. In addition, per languge custom
* [word definitions](#LanguageConfiguration.wordPattern) can be defined. It
* is also possible to provide a custom regular expression.
* is also possible to provide a custom regular expression. *Note* that a
* custom regular expression must not match the empty string and that it will
* be ignored if it does.
*
* The position will be [adjusted](#TextDocument.validatePosition).
*
......
......@@ -243,6 +243,7 @@ export class ExtHostDocumentData extends MirrorModel {
private _getWordRangeAtPosition(_position: vscode.Position, regexp?: RegExp): vscode.Range {
let position = this._validatePosition(_position);
if (!regexp || regExpLeadsToEndlessLoop(regexp)) {
console.warn(`[getWordRangeAtPosition]: ignoring custom regexp '${regexp.source}' because it matches the empty string.`);
regexp = getWordDefinitionFor(this._languageId);
}
let wordAtText = getWordAtText(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册