Skip to content

Commit 0ef2d84

Browse files
authored
fix: rename configuration key (#217)
* fix: rename task configuration key to taskfile * feat: add warning when an old config key is detected
1 parent ab642b6 commit 0ef2d84

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
"configuration": {
279279
"title": "Task configuration",
280280
"properties": {
281-
"task": {
281+
"taskfile": {
282282
"type": "object",
283283
"description": "Task configuration options.",
284284
"properties": {

src/utils/settings.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { log } from './log.js';
33

44
class Settings {
55
private static _instance: Settings;
6+
private static namespace = "taskfile";
67
public updateOn!: UpdateOn;
78
public path!: string;
89
public outputTo!: OutputTo;
@@ -23,8 +24,18 @@ class Settings {
2324
public update() {
2425
log.info("Updating settings");
2526

27+
// Check if the old configuration still exists
28+
let oldConfig = vscode.workspace.getConfiguration("task");
29+
if (oldConfig) {
30+
vscode.window.showWarningMessage(`Task changed its configuration namespace from "task" to "taskfile". Your task settings will not be applied until you update your settings accordingly.`, "More Info").then(selection => {
31+
if (selection === "More Info") {
32+
vscode.env.openExternal(vscode.Uri.parse("https://taskfile.dev/docs/integrations#configuration-namespace-change"));
33+
}
34+
});
35+
}
36+
2637
// Get the workspace config
27-
let config = vscode.workspace.getConfiguration("task");
38+
let config = vscode.workspace.getConfiguration(Settings.namespace);
2839

2940
// Set the properties
3041
this.updateOn = config.get("updateOn") ?? UpdateOn.save;

0 commit comments

Comments
 (0)