feat: add npm run try for interactive extension testing#564
Conversation
eaf554a to
0a2a06d
Compare
0a2a06d to
958aaf7
Compare
|
@markkohdev thank you for yet another PR. Can you outline how this functionality differs from using the VSCode Launch Config (F5)? |
@cbandera great question! I actually didn't know about the launch configs when I originally made this PR but I did find them yesterday. That said, there's a couple differences between this functionality and the launch configs: Local IDE vs isolated VSCode instance Empty Workspace vs Test Workspace Packaging vs Source Code Debugging Overall, both solutions are good to have. I think I can update this PR to have the best of both worlds though, with switchable options at the launch config level |
|
@cbandera any thoughts on my last comment above? |
cbandera
left a comment
There was a problem hiding this comment.
I was inclined to say that we need another launch entrypoint. But given your explanation I do see that it would be useful (especially for PRs like #561 ).
And I think it could even be integrated with the F5 entrypoints. E.g. via:
{
"name": "Launch Extension (Isolated Test)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/scripts/try-extension.js",
"console": "integratedTerminal",
"env": {
"NODE_ENV": "development"
}
}I am having a hard time to decide what the best name would be. try seems to not really capture the whole nature of it.
Some ideas are: sandboxed-deploy, isolated-launch, packaged-preview... but I haven't found a favorite. Does any of these resonate with you?
Finally: It doesn't work on WSL which means I can't test it at the moment. The reason is that on WSL you typically start the GUI instance installed on windows and simply connect to your WSL instance through the "remote" extensions of VSCode.
I will try to get a setup on linux again though to test this.
| @@ -0,0 +1,151 @@ | |||
| #!/usr/bin/env node | |||
|
|
|||
| // Copyright 2026 The Bazel Authors. All rights reserved. | |||
There was a problem hiding this comment.
BTW @cameron-martin do you know what the right copyright header is since the project moved to the linux foundation? Do we use copyright/license headers at all anymore?
There was a problem hiding this comment.
No idea. Maybe ask in the bazel slack?
|
|
||
| // Always start from a fresh copy | ||
| if (fs.existsSync(workspaceCopy)) { | ||
| fs.rmSync(workspaceCopy, { recursive: true, force: true }); |
There was a problem hiding this comment.
Do we need to / should we cleanup the userDataDir and extensionsDir as well?
|
Tested it on native linux now and vscode doesn't start up either... :( |
Description
Sorry @cbandera, here's another quick one for ya 😅 This was helpful when I was debugging some of the logging and querying changes.
npm run tryscript that packages the extension, downloads a local VS Code instance, installs the.vsix, and opens a disposable copy of the test Bazel workspace for interactive experimentation..vscode-test/, so it doesn't affect the developer's normal VS Code installation..vscode-test/try-workspace/(skipping Bazel output symlinks) so edits made during experimentation don't modify source-controlled files.Related Issue
N/A
Testing
npm run tryand verify VS Code launches with the extension active and the test workspace open.git statusshows no changes totest/bazel_workspace/.npm run cleanand confirm.vscode-test/is removed.npm run trya second time and verify the workspace copy is refreshed (previous edits are gone).Checklist
npm run test)