Skip to content

Commit e1c3d06

Browse files
Allow to cancel resolveMainMethod codelens command (#881)
1 parent e6de5b3 commit e1c3d06

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/debugCodeLensProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class DebugCodeLensProvider implements vscode.CodeLensProvider {
102102

103103
public async provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): Promise<vscode.CodeLens[]> {
104104
try {
105-
const mainMethods: IMainMethod[] = await resolveMainMethod(document.uri);
105+
const mainMethods: IMainMethod[] = await resolveMainMethod(document.uri, token);
106106
return _.flatten(mainMethods.map((method) => {
107107
return [
108108
new vscode.CodeLens(method.range, {

src/languageServerPlugin.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export interface ILaunchValidationResponse {
3333
readonly proposals?: IMainClassOption[];
3434
}
3535

36-
export async function resolveMainMethod(uri: vscode.Uri): Promise<IMainMethod[]> {
36+
export async function resolveMainMethod(uri: vscode.Uri, token?: vscode.CancellationToken): Promise<IMainMethod[]> {
37+
if (token) {
38+
return <IMainMethod[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINMETHOD, uri.toString(), token);
39+
}
40+
3741
return <IMainMethod[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINMETHOD, uri.toString());
3842
}
3943

0 commit comments

Comments
 (0)