parent
fcc10e46c3
commit
b89738c83b
|
@ -8,6 +8,7 @@ import * as vscode from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import type * as Proto from '../protocol';
|
import type * as Proto from '../protocol';
|
||||||
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
||||||
|
import API from '../utils/api';
|
||||||
import * as typeConverters from '../utils/typeConverters';
|
import * as typeConverters from '../utils/typeConverters';
|
||||||
import FileConfigurationManager from './fileConfigurationManager';
|
import FileConfigurationManager from './fileConfigurationManager';
|
||||||
|
|
||||||
|
@ -24,6 +25,10 @@ class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||||
position: vscode.Position,
|
position: vscode.Position,
|
||||||
token: vscode.CancellationToken
|
token: vscode.CancellationToken
|
||||||
): Promise<vscode.Range | null> {
|
): Promise<vscode.Range | null> {
|
||||||
|
if (this.client.apiVersion.lt(API.v310)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const response = await this.execRename(document, position, token);
|
const response = await this.execRename(document, position, token);
|
||||||
if (response?.type !== 'response' || !response.body) {
|
if (response?.type !== 'response' || !response.body) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -34,12 +39,7 @@ class TypeScriptRenameProvider implements vscode.RenameProvider {
|
||||||
return Promise.reject<vscode.Range>(renameInfo.localizedErrorMessage);
|
return Promise.reject<vscode.Range>(renameInfo.localizedErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
const triggerSpan = renameInfo.triggerSpan; // added in TS 3.1
|
return typeConverters.Range.fromTextSpan(renameInfo.triggerSpan);
|
||||||
if (triggerSpan) {
|
|
||||||
return typeConverters.Range.fromTextSpan(triggerSpan);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async provideRenameEdits(
|
public async provideRenameEdits(
|
||||||
|
|
Loading…
Reference in a new issue