Skip to content

Commit 3effb19

Browse files
authored
perf: register context provider while java ls ready (#939)
* perf: register context provider while java ls ready * fix: fix whitespace
1 parent 9438d1b commit 3effb19

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { CodeActionProvider } from "./tasks/buildArtifact/migration/CodeActionPr
2222
import { newJavaFile } from "./explorerCommands/new";
2323
import upgradeManager from "./upgrade/upgradeManager";
2424
import { registerCopilotContextProviders } from "./copilot/contextProvider";
25+
import { languageServerApiManager } from "./languageServerApi/languageServerApiManager";
2526

2627
export async function activate(context: ExtensionContext): Promise<void> {
2728
contextManager.initialize(context);
@@ -38,7 +39,6 @@ export async function activate(context: ExtensionContext): Promise<void> {
3839
}
3940
});
4041
contextManager.setContextValue(Context.EXTENSION_ACTIVATED, true);
41-
registerCopilotContextProviders(context);
4242
}
4343

4444
async function activateExtension(_operationId: string, context: ExtensionContext): Promise<void> {
@@ -85,6 +85,13 @@ async function activateExtension(_operationId: string, context: ExtensionContext
8585
}
8686
));
8787
setContextForDeprecatedTasks();
88+
89+
// Register Copilot context providers after Java Language Server is ready
90+
languageServerApiManager.ready().then((isReady) => {
91+
if (isReady) {
92+
registerCopilotContextProviders(context);
93+
}
94+
});
8895
}
8996

9097
// this method is called when your extension is deactivated

0 commit comments

Comments
 (0)