Skip to content

Commit 11d020e

Browse files
authored
fix: remove extensionDependencies on github.copilot-chat for SSH-Remote compatibility (#45)
1 parent 1bd8636 commit 11d020e

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
"vscode": "^1.116.0",
1515
"node": ">=24"
1616
},
17-
"extensionDependencies": [
18-
"github.copilot-chat"
19-
],
2017
"extensionKind": [
2118
"workspace"
2219
],

src/extension.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { DeepSeekChatProvider } from './provider';
77

88
let activeProvider: DeepSeekChatProvider | undefined;
99

10-
export function activate(context: vscode.ExtensionContext) {
10+
export async function activate(context: vscode.ExtensionContext) {
1111
logger.info(
1212
`Activating extension version=${context.extension.packageJSON.version}` +
1313
` debug=${getDebugLoggingEnabled()}`,
@@ -38,23 +38,25 @@ export function activate(context: vscode.ExtensionContext) {
3838
vscode.lm.registerLanguageModelChatProvider('deepseek', provider),
3939
);
4040

41-
// Fix(#12): configurationSchema (Thinking Effort dropdown) is a non-public
42-
// field that Copilot Chat does not persist in its chatLanguageModels.json
43-
// cache. On startup, Copilot Chat initialises the model picker from cache
44-
// and silently drops configurationSchema, so the per-model config menu
45-
// never appears on first launch.
41+
// Fix(#12): Copilot Chat caches model info in chatLanguageModels.json
42+
// but silently drops configurationSchema (Thinking Effort dropdown).
43+
// Re-firing onDidChangeLanguageModelChatInformation forces Copilot Chat
44+
// to re-query our provider through the full (non-cached) path.
4645
//
47-
// Re-firing onDidChangeLanguageModelChatInformation here forces Copilot
48-
// Chat to re-query our provider through the full (non-cached) path, which
49-
// correctly picks up configurationSchema.
46+
// To avoid a race where our refresh event fires before Copilot Chat is
47+
// listening, we programmatically activate Copilot Chat first. We do NOT
48+
// use extensionDependencies because built-in extensions aren't enumerable
49+
// in Remote-SSH hosts (#37), which causes the hard dependency to fail.
5050
//
51-
// This works because registerLanguageModelChatProvider() is synchronous,
52-
// so the provider is fully registered before we fire the refresh and the
53-
// host has already subscribed to receive the change. Copilot Chat can then
54-
// re-query complete model information through the non-cached path. The
55-
// extensionDependencies on github.copilot-chat in package.json
56-
// additionally guarantees Copilot Chat is fully activated before this
57-
// extension's activate() runs, eliminating any activation ordering race.
51+
// If Copilot Chat is unavailable (e.g. Remote-SSH without built-in
52+
// registration), we log a warning and proceed — Copilot Chat as a
53+
// built-in typically initialises before onStartupFinished anyway.
54+
try {
55+
await vscode.extensions.getExtension('github.copilot-chat')?.activate();
56+
} catch {
57+
logger.warn('Copilot Chat activation unavailable; model picker refresh may be delayed');
58+
}
59+
5860
provider.refreshModelPicker();
5961

6062
void showWelcomeIfNeeded(context, provider).catch((error) => {

0 commit comments

Comments
 (0)