Skip to content

Commit

Permalink
helpful VS Code launch profile for running a separate instance (#384)
Browse files Browse the repository at this point in the history
This makes it easier to test settings and auth in the extension host
without interfering with your main instance of VS Code.
  • Loading branch information
sqs authored Jul 26, 2023
1 parent c9f1096 commit 8e1aad2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@
"NODE_ENV": "development",
"CODY_FOCUS_ON_STARTUP": "1"
}
},
{
"name": "Launch VS Code Extension (Separate Instance)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"preLaunchTask": "Build VS Code Extension",
"args": [
"--user-data-dir=/tmp/vscode-cody-extension-dev-host",
"--profile-temp",
"--extensionDevelopmentPath=${workspaceRoot}/vscode",
"--disable-extension=sourcegraph.cody-ai",
"--disable-extension=github.copilot",
"--disable-extension=github.copilot-nightly"
],
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/vscode/dist/**/*.js"],
"env": {
"NODE_ENV": "development",
"CODY_PROFILE_TEMP": "true",
"CODY_DEBUG_ENABLE": "true",
"CODY_FOCUS_ON_STARTUP": "1"
}
}
]
}
4 changes: 3 additions & 1 deletion vscode/src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export function debug(filterLabel: string, text: string, ...args: unknown[]): vo
const workspaceConfig = vscode.workspace.getConfiguration()
const config = getConfiguration(workspaceConfig)

if (!outputChannel || !config.debugEnable) {
const debugEnable = process.env.CODY_DEBUG_ENABLE === 'true' || config.debugEnable

if (!outputChannel || !debugEnable) {
return
}

Expand Down
4 changes: 3 additions & 1 deletion vscode/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export async function start(context: vscode.ExtensionContext): Promise<vscode.Di
await migrateConfiguration()

const secretStorage =
process.env.CODY_TESTING === 'true' ? new InMemorySecretStorage() : new VSCodeSecretStorage(context.secrets)
process.env.CODY_TESTING === 'true' || process.env.CODY_PROFILE_TEMP === 'true'
? new InMemorySecretStorage()
: new VSCodeSecretStorage(context.secrets)
const localStorage = new LocalStorage(context.globalState)
const rgPath = await getRgPath(context.extensionPath)

Expand Down

0 comments on commit 8e1aad2

Please sign in to comment.