From e14e783ca890d389a2db4eb22a043aeb10201cd5 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 26 May 2017 11:00:10 +0200 Subject: [PATCH] followup fix from fix #27245 --- src/vs/workbench/api/node/extHostDocumentData.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/node/extHostDocumentData.ts b/src/vs/workbench/api/node/extHostDocumentData.ts index e52493a31e0..be60815d553 100644 --- a/src/vs/workbench/api/node/extHostDocumentData.ts +++ b/src/vs/workbench/api/node/extHostDocumentData.ts @@ -242,10 +242,17 @@ 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.`); + + if (!regexp) { + // use default when custom-regexp isn't provided + regexp = getWordDefinitionFor(this._languageId); + + } else if (regExpLeadsToEndlessLoop(regexp)) { + // use default when custom-regexp is bad regexp = getWordDefinitionFor(this._languageId); + console.warn(`[getWordRangeAtPosition]: ignoring custom regexp '${regexp.source}' because it matches the empty string.`); } + let wordAtText = getWordAtText( position.character + 1, ensureValidWordDefinition(regexp), -- GitLab