Skip to content

Commit 1896f00

Browse files
committed
feat: register registerCopilotContextProviders
1 parent 0d78220 commit 1896f00

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

src/commands/handler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,4 @@ export async function toggleAwtDevelopmentHandler(context: vscode.ExtensionConte
126126

127127
fetchInitProps(context);
128128
vscode.window.showInformationMessage(`Java AWT development is ${enable ? "enabled" : "disabled"}.`);
129-
}
130-
131-
export async function getImportClassContent(uri: string): Promise<INodeImportClass[]> {
132-
return await vscode.commands.executeCommand(Commands.EXECUTE_WORKSPACE_COMMAND, Commands.JAVA_PROJECT_GETIMPORTCLASSCONTENT, uri) || [];
133129
}

src/copilot/context/contextCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class ContextCache {
149149
const key = this.generateCacheKey(uri);
150150
if (this.cache.has(key)) {
151151
this.cache.delete(key);
152-
console.log('======== Cache invalidated for:', uri.toString());
152+
console.log('Cache invalidated for:', uri.toString());
153153
}
154154
}
155155

src/copilot/contextProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { getExtensionName } from '../utils/extension';
2020
export async function registerCopilotContextProviders(
2121
context: vscode.ExtensionContext
2222
) {
23-
const contextProviderIsEnabled = await getExpService().getTreatmentVariableAsync(TreatmentVariables.VSCodeConfig, TreatmentVariables.ContextProvider, true);
23+
const contextProviderIsEnabled = await getExpService().getTreatmentVariableAsync(TreatmentVariables.VSCodeConfig, TreatmentVariables.ContextProviderEnabled, true);
2424
if (!contextProviderIsEnabled) {
2525
sendInfo("", {
2626
"contextProviderEnabled": "false",
@@ -52,7 +52,7 @@ export async function registerCopilotContextProviders(
5252
if (activeEditor && activeEditor.document.languageId === 'java') {
5353
const cachedImports = contextCache.get(activeEditor.document.uri);
5454
if (cachedImports) {
55-
logger.info('======== Using cached imports, cache size:', cachedImports.length);
55+
logger.info('Using cached imports, cache size:', cachedImports.length);
5656
// Return cached result as context items
5757
return cachedImports.map((cls: any) => ({
5858
uri: cls.uri,
@@ -133,10 +133,10 @@ async function resolveJavaContext(_request: ResolveRequest, _token: vscode.Cance
133133
importClass = await CopilotHelper.resolveLocalImports(document.uri);
134134
if (importClass) {
135135
contextCache.set(document.uri, importClass);
136-
logger.info('======== Cached new imports, cache size:', importClass.length);
136+
logger.info('Cached new imports, cache size:', importClass.length);
137137
}
138138
} else {
139-
logger.info('======== Using cached imports in resolveJavaContext, cache size:', importClass.length);
139+
logger.info('Using cached imports in resolveJavaContext, cache size:', importClass.length);
140140
}
141141

142142
if (importClass) {

src/exp/TreatmentVariables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export class TreatmentVariables {
66
public static readonly PresentWelcomePageByDefault = 'presentWelcomePageByDefault';
77
public static readonly JavaWalkthroughEnabled = "gettingStarted.overrideCategory.vscjava.vscode-java-pack.javaWelcome.when";
88
public static readonly JavaCompletionSampling = "javaCompletionSampling";
9-
public static readonly ContextProvider = "ContextProviderIsEnabled";
9+
public static readonly ContextProviderEnabled = "ContextProviderIsEnabled";
1010
}

0 commit comments

Comments
 (0)