Skip to content

Commit cf33381

Browse files
committed
feat!: Set mise.configureExtensionsAutomatically to false by default
1 parent 386c707 commit cf33381

10 files changed

Lines changed: 124 additions & 37 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The extension will notify you if neither is installed.
4444

4545
> [!NOTE]
4646
> The extension includes default settings that you might want to change. See the [configuration guide](https://hverlin.github.io/mise-vscode/tutorials/settinguptheextension/) to customize your set-up.
47-
> For example, you can choose to disable automatic configuration of other extensions or change the path to the `mise` binary.
47+
> For example, you can choose to enable/disable automatic configuration of other extensions or change the path to the `mise` binary.
4848
>
4949
> You can access the settings by clicking on the mise extension indicator in the status bar.
5050

docs/src/content/docs/reference/Settings.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ Mise environment to use. (https://mise.jdx.dev/configuration/environments.html)
5050

5151
##### `mise.configureExtensionsAutomatically`
5252
- **Type:** `boolean`
53-
- **Default:** `true`
53+
- **Default:** `false`
54+
55+
Automatically configure extensions for the current workspace. ([list of supported extensions](https://github.com/hverlin/mise-vscode/wiki/Supported-extensions)).
5456

55-
Automatically configure extensions for the current workspace. ([list of supported extensions](https://github.com/hverlin/mise-vscode/wiki/Supported-extensions))
57+
This will modify your workspace settings (`.vscode/settings.json`). You can use the ignore/include lists settings to customize which extensions are configured.
5658

5759
---
5860

@@ -143,11 +145,11 @@ This is useful if you share the `.vscode/settings.json` file with others. When t
143145

144146
---
145147

146-
##### `mise.enableCodeLens`
148+
##### `mise.checkForNewMiseVersion`
147149
- **Type:** `boolean`
148150
- **Default:** `true`
149151

150-
Show run/add tool code lens indicators in the editor.
152+
Check if a new mise version is available on startup.
151153

152154
---
153155

@@ -159,11 +161,11 @@ Show tool versions in the editor. (requires reload)
159161

160162
---
161163

162-
##### `mise.checkForNewMiseVersion`
164+
##### `mise.enableCodeLens`
163165
- **Type:** `boolean`
164166
- **Default:** `true`
165167

166-
Check if a new mise version is available on startup.
168+
Show run/add tool code lens indicators in the editor.
167169

168170
---
169171

@@ -195,7 +197,7 @@ Update terminal environment variables automatically based on the mise configurat
195197
- **Type:** `boolean`
196198
- **Default:** `true`
197199

198-
Enable experimental Tera auto-completion in `mise.toml` files.
200+
Enable Tera auto-completion in `mise.toml` files.
199201

200202
---
201203

docs/src/content/docs/tutorials/SettingUpTheExtension.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ This might not work for you so make sure to update it manually if needed. You ca
1717

1818
### Automatic configuration of VS Code extensions
1919

20-
By default, this extension will modify your `.vscode/settings.json` file so that [other extensions](/mise-vscode/reference/supported-extensions/) you use will use the tools you installed with `mise`.
20+
In order for some VS Code extensions to use the tools installed by `mise`, they need to be configured to point to the correct tool paths.
21+
This is usually done by updating your workspace's `.vscode/settings.json` file with the correct paths to the tools installed by `mise` or by ensuring that VS Code reads your `PATH` (see [IDE Integration documentation](https://mise.jdx.dev/ide-integration.html#adding-shims-to-path-default-shell)).
2122

22-
**This might be a problem if you are sharing the `.vscode/settings.json` file with others.** (e.g., in a Git repository)
23+
By default, this extension **will not** automatically modify your `.vscode/settings.json` file.
2324

24-
- This can be [turned off](/mise-vscode/reference/settings/#miseconfigureextensionsautomatically) if you don't want this behavior.
25-
- Alternatively, you can configure the extension to create symlinks to tools so that the settings points to a relative path in your project. Use [`mise.configureExtensionsUseSymLinks`](/mise-vscode/reference/settings/#miseconfigureextensionsusesymlinks) for this.
25+
You can [enable automatic configuration](/mise-vscode/reference/settings/#miseconfigureextensionsautomatically) so that [other extensions](/mise-vscode/reference/supported-extensions/) you use will automatically use the tools you installed with `mise`.
26+
27+
**If you enable this feature and are sharing the `.vscode/settings.json` file with others** (e.g., in a Git repository), you may want to configure the extension to create symlinks to tools so that the settings point to a relative path in your project. Use [`mise.configureExtensionsUseSymLinks`](/mise-vscode/reference/settings/#miseconfigureextensionsusesymlinks) for this. Note that I consider that sharing the `.vscode/settings.json` file is not a good idea in general (see details below).
2628

2729
<details>
2830
<summary>About sharing `.vscode/settings.json`</summary>
2931

30-
If you are sharing the `.vscode/settings.json` file with others, you might think that the default value of this extension is not a good idea.
31-
32-
However, there are some challenges with sharing `.vscode/settings.json`:
32+
If you enable automatic configuration and are sharing the `.vscode/settings.json` file with others, be aware of some challenges:
3333
- If you use extensions other members of your team don't have, you won't be able to update the settings file without conflicts.
3434
- If you would like some settings to be different for different members of your team, you won't be able to do so.
3535

package.json

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,34 @@
119119
}
120120
}
121121
],
122+
"walkthroughs": [
123+
{
124+
"id": "mise-getting-started",
125+
"title": "Mise VSCode setup",
126+
"description": "Important steps to get started with the Mise VSCode extension.",
127+
"when": "!isWeb",
128+
"steps": [
129+
{
130+
"id": "auto-configure",
131+
"title": "Auto-Configure Extensions",
132+
"description": "Choose whether to automatically configure VSCode extensions to use tools from mise.\n[Open settings](command:mise.openExtensionSettings)",
133+
"media": {
134+
"markdown": "walkthrough/auto-configure.md"
135+
},
136+
"when": "!isWeb"
137+
},
138+
{
139+
"id": "explore",
140+
"title": "Tips for using Mise VSCode",
141+
"description": "Open the mise panel to see tools, tasks and environment variables.\n[Open Mise Panel](command:workbench.view.extension.mise-panel)",
142+
"media": {
143+
"markdown": "walkthrough/explore.md"
144+
},
145+
"when": "!isWeb"
146+
}
147+
]
148+
}
149+
],
122150
"snippets": [
123151
{
124152
"language": "toml",
@@ -152,8 +180,8 @@
152180
"mise.configureExtensionsAutomatically": {
153181
"order": 4,
154182
"type": "boolean",
155-
"default": true,
156-
"markdownDescription": "Automatically configure extensions for the current workspace. ([list of supported extensions](https://github.com/hverlin/mise-vscode/wiki/Supported-extensions))"
183+
"default": false,
184+
"markdownDescription": "Automatically configure extensions for the current workspace. ([list of supported extensions](https://github.com/hverlin/mise-vscode/wiki/Supported-extensions)).\n\nThis will modify your workspace settings (`.vscode/settings.json`). You can use the ignore/include lists settings to customize which extensions are configured."
157185
},
158186
"mise.configureExtensionsAutomaticallyIgnoreList": {
159187
"order": 5,
@@ -240,27 +268,27 @@
240268
"default": false,
241269
"markdownDescription": "Create symlinks in your `.vscode` folder that links to the `mise` bin.\n\nThis is useful if you share the `.vscode/settings.json` file with others. When the project is version controlled:\n- every user must have the extension installed\n- the directory `.vscode/mise-tools` must be excluded from version control."
242270
},
243-
"mise.enableCodeLens": {
244-
"order": 8,
245-
"type": "boolean",
246-
"title": "Enable code lens",
247-
"default": true,
248-
"markdownDescription": "Show run/add tool code lens indicators in the editor."
249-
},
271+
"mise.checkForNewMiseVersion": {
272+
"order": 8,
273+
"type": "boolean",
274+
"title": "Check for new mise version",
275+
"default": true,
276+
"markdownDescription": "Check if a new mise version is available on startup."
277+
},
250278
"mise.showToolVersionsDecorations": {
251279
"order": 9,
252280
"type": "boolean",
253281
"title": "Show tool versions",
254282
"default": true,
255283
"markdownDescription": "Show tool versions in the editor. (requires reload)"
256284
},
257-
"mise.checkForNewMiseVersion": {
258-
"order": 10,
259-
"type": "boolean",
260-
"title": "Check for new mise version",
261-
"default": true,
262-
"markdownDescription": "Check if a new mise version is available on startup."
263-
},
285+
"mise.enableCodeLens": {
286+
"order": 10,
287+
"type": "boolean",
288+
"title": "Enable code lens",
289+
"default": true,
290+
"markdownDescription": "Show run/add tool code lens indicators in the editor."
291+
},
264292
"mise.showNotificationIfMissingTools": {
265293
"order": 11,
266294
"type": "boolean",
@@ -287,7 +315,7 @@
287315
"type": "boolean",
288316
"title": "Enable Tera auto-completion",
289317
"default": true,
290-
"markdownDescription": "Enable experimental Tera auto-completion in `mise.toml` files."
318+
"markdownDescription": "Enable Tera auto-completion in `mise.toml` files."
291319
},
292320
"mise.automaticallyTrustMiseConfigFiles": {
293321
"order": 15,

src/commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const MISE_CONFIGURE_ALL_SKD_PATHS = "mise.configureAllSdkPaths";
1+
export const MISE_CONFIGURE_ALL_SDK_PATHS = "mise.configureAllSdkPaths";
22
export const MISE_CONFIGURE_SDK_PATH = "mise.configureSdkPath";
33
export const MISE_COPY_ENV_VARIABLE_NAME = "mise.copyEnvVariableName";
44
export const MISE_COPY_ENV_VARIABLE_VALUE = "mise.copyEnvVariableValue";
@@ -40,3 +40,4 @@ export const MISE_SHOW_ENV_VARIABLE_VALUE = "mise.showEnvVariableValue";
4040
export const MISE_HIDE_ENV_VARIABLE_VALUE = "mise.hideEnvVariableValue";
4141
export const MISE_DISPLAY_PATH = "mise.displayPath";
4242
export const MISE_DOCTOR = "mise.doctor";
43+
export const MISE_ENABLE_AUTO_CONFIGURATION = "mise.enableAutoConfiguration";

src/configuration.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ export const shouldConfigureExtensionsAutomatically = (): boolean => {
5959
);
6060
};
6161

62+
export const enableAutoConfiguration = async () => {
63+
return getExtensionConfig().update(
64+
CONFIGURATION_FLAGS.configureExtensionsAutomatically,
65+
true,
66+
vscode.ConfigurationTarget.Global,
67+
);
68+
};
69+
6270
export const shouldUseShims = () => {
6371
return getConfOrElse(CONFIGURATION_FLAGS.configureExtensionsUseShims, true);
6472
};

src/miseExtension.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { createCache } from "async-cache-dedupe";
33
import vscode, { MarkdownString } from "vscode";
44
import { version } from "../package.json";
55
import {
6-
MISE_CONFIGURE_ALL_SKD_PATHS,
6+
MISE_CONFIGURE_ALL_SDK_PATHS,
77
MISE_DISMISS_MISSING_TOOLS_WARNING,
88
MISE_DOCTOR,
99
MISE_EDIT_SETTING,
10+
MISE_ENABLE_AUTO_CONFIGURATION,
1011
MISE_FMT,
1112
MISE_LIST_ALL_TOOLS,
1213
MISE_MISSING_TOOLS_MENU,
@@ -22,6 +23,7 @@ import {
2223
} from "./commands";
2324
import {
2425
CONFIGURATION_FLAGS,
26+
enableAutoConfiguration,
2527
getConfiguredBinPath,
2628
getCurrentWorkspaceFolder,
2729
getMiseEnv,
@@ -151,6 +153,19 @@ export class MiseExtension {
151153
),
152154
);
153155

156+
context.subscriptions.push(
157+
vscode.commands.registerCommand(
158+
MISE_ENABLE_AUTO_CONFIGURATION,
159+
async () => {
160+
await enableAutoConfiguration();
161+
logger.info("Auto-configuration enabled");
162+
await vscode.commands.executeCommand(MISE_CONFIGURE_ALL_SDK_PATHS);
163+
vscode.window.showInformationMessage(
164+
"Mise auto-configuration has been enabled and extensions have been configured.",
165+
);
166+
},
167+
),
168+
);
154169
const tasksProvider = new MiseTasksProvider(this.miseService);
155170
const toolsProvider = new MiseToolsProvider(this.miseService);
156171
const envsProvider = new MiseEnvsProvider(this.miseService);
@@ -219,7 +234,7 @@ export class MiseExtension {
219234
shouldConfigureExtensionsAutomatically() &&
220235
isMiseExtensionEnabled()
221236
) {
222-
await vscode.commands.executeCommand(MISE_CONFIGURE_ALL_SKD_PATHS);
237+
await vscode.commands.executeCommand(MISE_CONFIGURE_ALL_SDK_PATHS);
223238
}
224239

225240
this.updateStatusBar({ state: "ready" });

src/providers/toolsProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from "vscode";
22
import {
3-
MISE_CONFIGURE_ALL_SKD_PATHS,
3+
MISE_CONFIGURE_ALL_SDK_PATHS,
44
MISE_CONFIGURE_SDK_PATH,
55
MISE_COPY_TOOL_BIN_PATH,
66
MISE_COPY_TOOL_INSTALL_PATH,
@@ -616,7 +616,7 @@ export function registerToolsCommands(
616616
}
617617
},
618618
),
619-
vscode.commands.registerCommand(MISE_CONFIGURE_ALL_SKD_PATHS, async () => {
619+
vscode.commands.registerCommand(MISE_CONFIGURE_ALL_SDK_PATHS, async () => {
620620
await miseService.miseReshim();
621621

622622
const ignoreList = getIgnoreList();

walkthrough/auto-configure.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Welcome to Mise VSCode! 👋
2+
3+
This extension brings Mise support directly into Visual Studio Code.
4+
- Syntax highlighting, autocompletion and go-to-definition for `mise.toml` files
5+
- tools, tasks, and environment variables available directly from the sidebar
6+
- Ability to autoconfigure other extensions to use tools from mise.
7+
8+
# Auto-Configure Extensions
9+
10+
One of the main features of this extension is the ability to **automatically configure other VSCode extensions** to use tools managed by mise.
11+
12+
When enabled, the extension will automatically update your `.vscode/settings.json` file to configure supported VSCode extensions.
13+
See [the list of supported extensions](https://github.com/hverlin/mise-vscode/wiki/Supported-extensions).
14+
15+
To enable this feature, simply click this button:
16+
**[Enable Auto-Configuration](command:mise.enableAutoConfiguration)**
17+
18+
You can always change this setting later in the [extension settings](command:mise.openExtensionSettings).

walkthrough/explore.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Documentation
2+
3+
You can find the full documentation for the Mise VSCode extension at [hverlin.github.io/mise-vscode/](https://hverlin.github.io/mise-vscode/).
4+
5+
## 🛠️ Mise panel
6+
7+
[Open the **Mise** panel in the Activity Bar](command:workbench.view.extension.mise-panel) to run tasks, install tools, and view environment variables directly from the sidebar
8+
9+
## Quick actions
10+
Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) to open the command palette, then type `Mise` to see all available commands provided by the extension.
11+
12+
## Mise command menu
13+
14+
This extension provides a command menu accessible via the bottom status bar or the command palette: [Command Menu](command:mise.openMenu).
15+

0 commit comments

Comments
 (0)