mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 04:09:28 +00:00
Make execute command a configuration object
This commit is contained in:
@@ -26,7 +26,7 @@ export default class TypeScriptImplementationsCodeLensProvider extends TypeScrip
|
|||||||
const codeLens = inputCodeLens as ReferencesCodeLens;
|
const codeLens = inputCodeLens as ReferencesCodeLens;
|
||||||
|
|
||||||
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
|
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
|
||||||
const response = await this.client.execute('implementation', args, token, /* lowPriority */ true);
|
const response = await this.client.execute('implementation', args, token, { lowPriority: true });
|
||||||
if (response.type !== 'response' || !response.body) {
|
if (response.type !== 'response' || !response.body) {
|
||||||
codeLens.command = response.type === 'cancelled'
|
codeLens.command = response.type === 'cancelled'
|
||||||
? TypeScriptBaseCodeLensProvider.cancelledCommand
|
? TypeScriptBaseCodeLensProvider.cancelledCommand
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TypeScriptReferencesCodeLensProvider extends TypeScriptBaseCodeLensProvide
|
|||||||
public async resolveCodeLens(inputCodeLens: vscode.CodeLens, token: vscode.CancellationToken): Promise<vscode.CodeLens> {
|
public async resolveCodeLens(inputCodeLens: vscode.CodeLens, token: vscode.CancellationToken): Promise<vscode.CodeLens> {
|
||||||
const codeLens = inputCodeLens as ReferencesCodeLens;
|
const codeLens = inputCodeLens as ReferencesCodeLens;
|
||||||
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
|
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
|
||||||
const response = await this.client.execute('references', args, token, /* lowPriority */ true);
|
const response = await this.client.execute('references', args, token, { lowPriority: true });
|
||||||
if (response.type !== 'response' || !response.body) {
|
if (response.type !== 'response' || !response.body) {
|
||||||
codeLens.command = response.type === 'cancelled'
|
codeLens.command = response.type === 'cancelled'
|
||||||
? TypeScriptBaseCodeLensProvider.cancelledCommand
|
? TypeScriptBaseCodeLensProvider.cancelledCommand
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ interface AsyncTsServerRequests {
|
|||||||
|
|
||||||
export type TypeScriptRequests = StandardTsServerRequests & NoResponseTsServerRequests & AsyncTsServerRequests;
|
export type TypeScriptRequests = StandardTsServerRequests & NoResponseTsServerRequests & AsyncTsServerRequests;
|
||||||
|
|
||||||
|
export type ExecConfig = {
|
||||||
|
lowPriority?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export interface ITypeScriptServiceClient {
|
export interface ITypeScriptServiceClient {
|
||||||
/**
|
/**
|
||||||
* Convert a resource (VS Code) to a normalized path (TypeScript).
|
* Convert a resource (VS Code) to a normalized path (TypeScript).
|
||||||
@@ -120,7 +124,7 @@ export interface ITypeScriptServiceClient {
|
|||||||
command: K,
|
command: K,
|
||||||
args: StandardTsServerRequests[K][0],
|
args: StandardTsServerRequests[K][0],
|
||||||
token: vscode.CancellationToken,
|
token: vscode.CancellationToken,
|
||||||
lowPriority?: boolean
|
config?: ExecConfig
|
||||||
): Promise<ServerResponse.Response<StandardTsServerRequests[K][1]>>;
|
): Promise<ServerResponse.Response<StandardTsServerRequests[K][1]>>;
|
||||||
|
|
||||||
executeWithoutWaitingForResponse<K extends keyof NoResponseTsServerRequests>(
|
executeWithoutWaitingForResponse<K extends keyof NoResponseTsServerRequests>(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import BufferSyncSupport from './features/bufferSyncSupport';
|
|||||||
import { DiagnosticKind, DiagnosticsManager } from './features/diagnostics';
|
import { DiagnosticKind, DiagnosticsManager } from './features/diagnostics';
|
||||||
import * as Proto from './protocol';
|
import * as Proto from './protocol';
|
||||||
import { ITypeScriptServer } from './tsServer/server';
|
import { ITypeScriptServer } from './tsServer/server';
|
||||||
import { ITypeScriptServiceClient, ServerResponse, TypeScriptRequests } from './typescriptService';
|
import { ITypeScriptServiceClient, ServerResponse, TypeScriptRequests, ExecConfig } from './typescriptService';
|
||||||
import API from './utils/api';
|
import API from './utils/api';
|
||||||
import { TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
|
import { TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
|
||||||
import { Disposable } from './utils/dispose';
|
import { Disposable } from './utils/dispose';
|
||||||
@@ -607,12 +607,12 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public execute(command: keyof TypeScriptRequests, args: any, token: vscode.CancellationToken, lowPriority?: boolean): Promise<ServerResponse.Response<Proto.Response>> {
|
public execute(command: keyof TypeScriptRequests, args: any, token: vscode.CancellationToken, config?: ExecConfig): Promise<ServerResponse.Response<Proto.Response>> {
|
||||||
return this.executeImpl(command, args, {
|
return this.executeImpl(command, args, {
|
||||||
isAsync: false,
|
isAsync: false,
|
||||||
token,
|
token,
|
||||||
expectsResult: true,
|
expectsResult: true,
|
||||||
lowPriority
|
lowPriority: config ? config.lowPriority : undefined
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user