Skip to content

Commit c229951

Browse files
Allow to cancel resolveMainMethod codelens command
1 parent e6de5b3 commit c229951

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export interface ILaunchValidationResponse {
3333
readonly proposals?: IMainClassOption[];
3434
}
3535

36-
export async function resolveMainMethod(uri: vscode.Uri): Promise<IMainMethod[]> {
37-
return <IMainMethod[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINMETHOD, uri.toString());
36+
export async function resolveMainMethod(uri: vscode.Uri, token: vscode.CancellationToken): Promise<IMainMethod[]> {
37+
return <IMainMethod[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINMETHOD, uri.toString(), token);
3838
}
3939

4040
export function startDebugSession() {
@@ -108,3 +108,7 @@ export function fetchPlatformSettings(): any {
108108
export async function resolveClassFilters(patterns: string[]): Promise<string[]> {
109109
return <string[]> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_CLASSFILTERS, ...patterns);
110110
}
111+
112+
export async function resolveSourceUri(sourceLine: string): Promise<string> {
113+
return <string> await commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_SOURCEURI, sourceLine);
114+
}

0 commit comments

Comments
 (0)