提交 08ff1faa 编写于 作者: M Matt Bierner

Fix a few more edge cases for references code lens

上级 8bfcb15c
...@@ -148,11 +148,11 @@ export default class TypeScriptReferencesCodeLensProvider implements CodeLensPro ...@@ -148,11 +148,11 @@ export default class TypeScriptReferencesCodeLensProvider implements CodeLensPro
case PConst.Kind.enum: case PConst.Kind.enum:
const identifierMatch = new RegExp(`^(.*?(\\b|\\W))${item.text}\\b`, 'gm'); const identifierMatch = new RegExp(`^(.*?(\\b|\\W))${item.text}\\b`, 'gm');
const match = identifierMatch.exec(text); const match = identifierMatch.exec(text);
const start = match ? match.index + match[1].length : 0; const prefixLength = match ? match.index + match[1].length : 0;
const startPosition = new Position(range.start.line, range.start.character + start); const startOffset = document.offsetAt(new Position(range.start.line, range.start.character)) + prefixLength;
results.push(new Range( results.push(new Range(
startPosition, document.positionAt(startOffset),
document.positionAt(document.offsetAt(startPosition) + item.text.length))); document.positionAt(startOffset + item.text.length)));
break; break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册