提交 f516d172 编写于 作者: M Matt Bierner

Add support for TS RenameTextSpan

Fixes #60204
上级 09afa054
......@@ -11,6 +11,13 @@ import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
import API from '../utils/api';
import * as typeConverters from '../utils/typeConverters';
// TODO: Remove when we pick up TS 3.2
declare module '../protocol' {
interface RenameTextSpan extends TextSpan {
readonly prefixText?: string;
readonly suffixText?: string;
}
}
const localize = nls.loadMessageBundle();
......@@ -102,8 +109,9 @@ class TypeScriptRenameProvider implements vscode.RenameProvider {
for (const spanGroup of locations) {
const resource = this.client.toResource(spanGroup.file);
if (resource) {
for (const textSpan of spanGroup.locs) {
edit.replace(resource, typeConverters.Range.fromTextSpan(textSpan), newName);
for (const textSpan of spanGroup.locs as Proto.RenameTextSpan[]) {
edit.replace(resource, typeConverters.Range.fromTextSpan(textSpan),
(textSpan.prefixText || '') + newName + (textSpan.suffixText || ''));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册