Skip to content

Commit b8fd158

Browse files
jdneorgrunber
authored andcommitted
Reduce delegate command calls when classpath changes
Signed-off-by: Sheng Chen <[email protected]>
1 parent eaeedf7 commit b8fd158

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lombokSupport.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as fse from "fs-extra";
44
import * as path from "path";
55
import * as semver from 'semver';
66
import * as vscode from "vscode";
7-
import { ExtensionContext, window, commands } from "vscode";
7+
import { ExtensionContext, window, commands, Uri } from "vscode";
88
import { Commands } from "./commands";
99
import { apiManager } from "./apiManager";
1010
import { languageStatusBarProvider } from './runtimeStatusBarProvider';
@@ -117,7 +117,7 @@ export function addLombokParam(context: ExtensionContext, params: string[]) {
117117
updateActiveLombokPath(lombokJarPath);
118118
}
119119

120-
export async function checkLombokDependency(context: ExtensionContext) {
120+
export async function checkLombokDependency(context: ExtensionContext, projectUri?: Uri) {
121121
if (!isLombokSupportEnabled()) {
122122
return;
123123
}
@@ -126,7 +126,7 @@ export async function checkLombokDependency(context: ExtensionContext) {
126126
let currentLombokVersion: string = undefined;
127127
let previousLombokVersion: string = undefined;
128128
let currentLombokClasspath: string = undefined;
129-
const projectUris: string[] = await getAllJavaProjects();
129+
const projectUris: string[] = projectUri ? [projectUri.toString()] : await getAllJavaProjects();
130130
for (const projectUri of projectUris) {
131131
const classpathResult = await apiManager.getApiInstance().getClasspaths(projectUri, {scope: 'test'});
132132
for (const classpath of classpathResult.classpaths) {

src/standardLanguageClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ export class StandardLanguageClient {
143143
showImportFinishNotification(context);
144144
}
145145
checkLombokDependency(context);
146-
apiManager.getApiInstance().onDidClasspathUpdate((e: Uri) => {
147-
checkLombokDependency(context);
146+
apiManager.getApiInstance().onDidClasspathUpdate((projectUri: Uri) => {
147+
checkLombokDependency(context, projectUri);
148148
});
149149
// Disable the client-side snippet provider since LS is ready.
150150
snippetCompletionProvider.dispose();

0 commit comments

Comments
 (0)