Allow to cancel resolveMainMethod codelens command (#881)
This commit is contained in:
parent
e6de5b3ad6
commit
e1c3d0682b
|
@ -102,7 +102,7 @@ class DebugCodeLensProvider implements vscode.CodeLensProvider {
|
|||
|
||||
public async provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): Promise<vscode.CodeLens[]> {
|
||||
try {
|
||||
const mainMethods: IMainMethod[] = await resolveMainMethod(document.uri);
|
||||
const mainMethods: IMainMethod[] = await resolveMainMethod(document.uri, token);
|
||||
return _.flatten(mainMethods.map((method) => {
|
||||
return [
|
||||
new vscode.CodeLens(method.range, {
|
||||
|
|
|
@ -33,7 +33,11 @@ export interface ILaunchValidationResponse {
|
|||
readonly proposals?: IMainClassOption[];
|
||||
}
|
||||
|
||||
export async function resolveMainMethod(uri: vscode.Uri): Promise<IMainMethod[]> {
|
||||
export async function resolveMainMethod(uri: vscode.Uri, token?: vscode.CancellationToken): Promise<IMainMethod[]> {
|
||||
if (token) {
|
||||
return <IMainMethod[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINMETHOD, uri.toString(), token);
|
||||
}
|
||||
|
||||
return <IMainMethod[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINMETHOD, uri.toString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue