Skip to content

Commit

Permalink
feat: add welcome views if mise is not installed/configured
Browse files Browse the repository at this point in the history
  • Loading branch information
hverlin committed Nov 14, 2024
1 parent 58c040e commit 1731150
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
27 changes: 26 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@
}
]
},
"viewsWelcome": [
{
"view": "miseTasksView",
"contents": "[Tasks](https://mise.jdx.dev/tasks/) will be displayed here.\n[Refresh](command:mise.refreshEntry)",
"when": "config.mise.binPath"
},
{
"view": "miseTasksView",
"contents": "[Install mise](https://mise.jdx.dev/getting-started.html) to get started.\nOnce mise is installed, click reload.\n[Reload](command:mise.refreshEntry)\n[Configure](command:mise.openSettings)",
"when": "!config.mise.binPath"
},
{
"view": "miseToolsView",
"contents": "[Tools](https://mise.jdx.dev/dev-tools/) will be displayed here."
},
{
"view": "miseEnvsView",
"contents": "[Environment variables](https://mise.jdx.dev/environments.html) will be displayed here."
}
],
"views": {
"mise-panel": [
{
Expand Down Expand Up @@ -158,7 +178,7 @@
},
{
"command": "mise.installAll",
"title": "Mise: run mise install",
"title": "Mise: Run mise install",
"icon": "$(cloud-download)"
},
{
Expand All @@ -173,6 +193,11 @@
{
"command": "mise.configureAllSdkPaths",
"title": "Mise: Configure all extension sdk paths"
},
{
"command": "mise.openSettings",
"title": "Mise: Open Settings",
"icon": "$(tools)"
}
],
"menus": {
Expand Down
13 changes: 10 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ export async function activate(context: vscode.ExtensionContext) {
}
} catch (error) {
statusBarItem.text = "$(error) Mise";
vscode.window.showErrorMessage(
`Failed to refresh Mise views: ${error}`,
);
vscode.window.showErrorMessage(`${error}`);
}
}),
);
Expand All @@ -135,6 +133,15 @@ export async function activate(context: vscode.ExtensionContext) {
),
);

context.subscriptions.push(
vscode.commands.registerCommand("mise.openSettings", () => {
vscode.commands.executeCommand(
"workbench.action.openSettings",
"@ext:hverlin.mise-vscode",
);
}),
);

const rootFolder = vscode.workspace.workspaceFolders?.[0];
if (rootFolder) {
context.subscriptions.push(
Expand Down
4 changes: 3 additions & 1 deletion src/miseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ function ensureMiseCommand(
miseCommand: string | undefined,
): asserts miseCommand {
if (!miseCommand) {
throw new Error("Mise binary path is not configured");
throw new Error(
"Mise binary path is not configured. [Install mise](https://mise.jdx.dev/getting-started.html)",
);
}
}

Expand Down

0 comments on commit 1731150

Please sign in to comment.