Skip to content

Commit bafc70d

Browse files
authored
[vscode-extension] Adding missing commands to devbox vscode extension - v0.1.1 (#1219)
## Summary - Fixed small issue in readme from last release - added missing commands from CLI to vscode extension's command palette (install, update, search) Q: should I add more devbox commands? e.g., global, info, version, auth, etc. ## How was it tested? - vsce package - code --install <generated-devbox>.vsix - open a project with devbox.json - cmd+shift+p and type devbox - confirm install, update and search exists in the list of available commands and try them.
1 parent 9e3638f commit bafc70d

File tree

4 files changed

+57
-5
lines changed

4 files changed

+57
-5
lines changed

vscode-extension/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to the "devbox" extension will be documented in this file.
44

55
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
66

7+
## [0.1.1]
8+
9+
- Fixed documentation
10+
- Added devbox install command
11+
- Added devbox update command
12+
- Added devbox search command
13+
714
## [0.1.0]
815

916
- Added reopen in devbox shell environment feature that allows projects with devbox.json

vscode-extension/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ This is the official VSCode extension for [devbox](https://github.com/jetpack-io
88

99
If a Devbox Cloud instance (from [devbox.sh](https://devbox.sh)) has an `Open In Desktop` button, this extension will make VSCode to be able to connect its workspace to the instance.
1010

11-
NOTE: Requires devbox CLI v0.5.5 and above
12-
installed and in PATH. This feature is in beta. Please report any bugs/issues in [Github](https://github.com/jetpack-io/devbox) or our [Discord](https://discord.gg/Rr5KPJq7).
13-
1411
### Auto Shell on a devbox project
1512

1613
When VSCode Terminal is opened on a devbox project, this extension detects `devbox.json` and runs `devbox shell` so terminal is automatically in devbox shell environment. Can be turned off in settings.
@@ -24,6 +21,9 @@ If the opened workspace in VSCode has a devbox.json file, from command palette,
2421
3. Interact with Devbox CLI to setup a devbox shell.
2522
4. Close current VSCode window and reopen it in a devbox shell environment as if VSCode was opened from a devbox shell terminal.
2623

24+
NOTE: Requires devbox CLI v0.5.5 and above
25+
installed and in PATH. This feature is in beta. Please report any bugs/issues in [Github](https://github.com/jetpack-io/devbox) or our [Discord](https://discord.gg/Rr5KPJq7).
26+
2727
### Run devbox commands from command palette
2828

2929
`cmd/ctrl + shift + p` opens vscode's command palette. Typing devbox filters all available commands devbox extension can run. Those commands are:
@@ -33,6 +33,9 @@ If the opened workspace in VSCode has a devbox.json file, from command palette,
3333
- **Remove:** Removes a package from devbox.json
3434
- **Shell:** Opens a terminal and runs devbox shell
3535
- **Run:** Runs a script from devbox.json if specified
36+
- **Install** Install packages specified in devbox.json
37+
- **Update** Update packages specified in devbox.json
38+
- **Search** Search for packages to add to your devbox project
3639
- **Generate DevContainer files:** Generates devcontainer.json & Dockerfile inside .devcontainers directory. This allows for running vscode in a container or GitHub Codespaces.
3740
- **Generate a Dockerfile from devbox.json:** Generates a Dockerfile a project's root directory. This allows for running the devbox project in a container.
3841
- **Reopen in Devbox shell environment:** Allows projects with devbox.json

vscode-extension/package.json

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "devbox",
33
"displayName": "devbox by jetpack.io",
44
"description": "devbox integration for VSCode",
5-
"version": "0.1.0",
5+
"version": "0.1.1",
66
"icon": "assets/icon.png",
77
"repository": {
88
"type": "git",
@@ -34,6 +34,18 @@
3434
"command": "devbox.reopen",
3535
"title": "Devbox: Reopen in Devbox shell environment"
3636
},
37+
{
38+
"command": "devbox.install",
39+
"title": "Devbox: Install - Install packages in your devbox project"
40+
},
41+
{
42+
"command": "devbox.update",
43+
"title": "Devbox: Update - Update packages in your devbox project"
44+
},
45+
{
46+
"command": "devbox.search",
47+
"title": "Devbox: Search - Search for packages for your devbox project"
48+
},
3749
{
3850
"command": "devbox.generateDockerfile",
3951
"title": "Devbox: Generate a Dockerfile from devbox.json"
@@ -66,7 +78,20 @@
6678
"when": "devbox.configFileExists == true"
6779
},
6880
{
69-
"command": "devbox.reopen"
81+
"command": "devbox.reopen",
82+
"when": "devbox.configFileExists == true"
83+
},
84+
{
85+
"command": "devbox.install",
86+
"when": "devbox.configFileExists == true"
87+
},
88+
{
89+
"command": "devbox.update",
90+
"when": "devbox.configFileExists == true"
91+
},
92+
{
93+
"command": "devbox.search",
94+
"when": "devbox.configFileExists == true"
7095
},
7196
{
7297
"command": "devbox.add",

vscode-extension/src/extension.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,23 @@ export function activate(context: ExtensionContext) {
7777
commands.executeCommand('setContext', 'devbox.configFileExists', true);
7878
});
7979

80+
const devboxInstall = commands.registerCommand('devbox.install', async () => {
81+
await runInTerminal('devbox install', true);
82+
});
83+
84+
const devboxUpdate = commands.registerCommand('devbox.update', async () => {
85+
await runInTerminal('devbox update', true);
86+
});
87+
88+
const devboxSearch = commands.registerCommand('devbox.search', async () => {
89+
const result = await window.showInputBox({ placeHolder: "Name or a subset of a name of a package to search" });
90+
await runInTerminal(`devbox search ${result}`, true);
91+
});
92+
8093
const setupDevcontainer = commands.registerCommand('devbox.setupDevContainer', async () => {
8194
await runInTerminal('devbox generate devcontainer', true);
8295
});
96+
8397
const generateDockerfile = commands.registerCommand('devbox.generateDockerfile', async () => {
8498
await runInTerminal('devbox generate dockerfile', true);
8599
});
@@ -92,6 +106,9 @@ export function activate(context: ExtensionContext) {
92106
context.subscriptions.push(devboxAdd);
93107
context.subscriptions.push(devboxRun);
94108
context.subscriptions.push(devboxInit);
109+
context.subscriptions.push(devboxInstall);
110+
context.subscriptions.push(devboxSearch);
111+
context.subscriptions.push(devboxUpdate);
95112
context.subscriptions.push(devboxRemove);
96113
context.subscriptions.push(devboxShell);
97114
context.subscriptions.push(setupDevcontainer);

0 commit comments

Comments
 (0)