mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-11-02 05:03:26 +08:00
fix: activate extension on startup so eager connect() actually runs
The previous commit added connectionService.connect() in activate(), but activate() itself never ran without the sidebar open because activationEvents was empty. VS Code only triggered activation when the sidebar view was shown. Add 'onStartupFinished' to activationEvents so the extension activates after VS Code startup completes. Guard the eager connect() behind the autocomplete enableAutoTrigger setting to avoid spawning a CLI server process when autocomplete is disabled.
This commit is contained in:
@@ -45,13 +45,7 @@
|
||||
"kilocode"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onWebviewPanel:kilo-code.new.AgentManagerPanel",
|
||||
"onWebviewPanel:kilo-code.new.TabPanel",
|
||||
"onWebviewPanel:kilo-code.new.settingsPanel",
|
||||
"onWebviewPanel:kilo-code.new.profilePanel",
|
||||
"onWebviewPanel:kilo-code.new.marketplacePanel",
|
||||
"onWebviewPanel:kilo-code.new.DiffViewerPanel",
|
||||
"onWebviewPanel:kilo-code.new.SubAgentViewerPanel"
|
||||
"onStartupFinished"
|
||||
],
|
||||
"main": "./dist/extension.js",
|
||||
"contributes": {
|
||||
|
||||
@@ -257,10 +257,15 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
// Start the CLI backend server eagerly so autocomplete works without opening a Kilo tab.
|
||||
// connectionService.connect() is idempotent — when a webview later calls connect(), it's a no-op.
|
||||
const workspaceDir = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? process.cwd()
|
||||
connectionService.connect(workspaceDir).catch((error) => {
|
||||
console.error("[Kilo New] Extension: Failed to eagerly start CLI backend:", error)
|
||||
})
|
||||
// Only start eagerly if autocomplete is enabled to avoid spawning a server process unnecessarily.
|
||||
const autocompleteEnabled =
|
||||
vscode.workspace.getConfiguration("kilo-code.new.autocomplete").get<boolean>("enableAutoTrigger") ?? true
|
||||
if (autocompleteEnabled) {
|
||||
const workspaceDir = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? process.cwd()
|
||||
connectionService.connect(workspaceDir).catch((error) => {
|
||||
console.error("[Kilo New] Extension: Failed to eagerly start CLI backend:", error)
|
||||
})
|
||||
}
|
||||
|
||||
// Register commit message generation
|
||||
registerCommitMessageService(context, connectionService)
|
||||
|
||||
Reference in New Issue
Block a user