Skip to content

Commit

Permalink
feat: Add an icon for outdated tools in the editor gutter
Browse files Browse the repository at this point in the history
  • Loading branch information
hverlin committed Dec 25, 2024
1 parent 2b93172 commit e1d761d
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 110 deletions.
8 changes: 8 additions & 0 deletions docs/src/content/docs/reference/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ Time to live in seconds for the mise command cache. Only changed it if some comm

---

##### `mise.showOutdatedToolGutterDecorations`
- **Type:** `boolean`
- **Default:** `true`

Show outdated tool gutter decorations in the editor.

---

16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@
"title": "Command TTL cache seconds",
"default": 2,
"markdownDescription": "Time to live in seconds for the mise command cache. Only changed it if some commands are expensive to run."
},
"mise.showOutdatedToolGutterDecorations": {
"order": 16,
"type": "boolean",
"title": "Show outdated tool gutter decorations",
"default": true,
"markdownDescription": "Show outdated tool gutter decorations in the editor."
}
}
},
Expand Down Expand Up @@ -540,6 +547,13 @@
"command": "mise.copyEnvVariableValue",
"group": "2_modification"
}
],
"editor/lineNumber/context": [
{
"command": "mise.listAllTools",
"group": "inline",
"when": "editorLineNumber in mise.linesWithOutdatedTools"
}
]
},
"taskDefinitions": [
Expand Down Expand Up @@ -602,7 +616,7 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/vscode": "^1.85.0",
"bun": "^1.1.38",
"bun": "^1.1.42",
"typescript": "^5.6.3"
},
"packageManager": "[email protected]+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228",
Expand Down
102 changes: 65 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const CONFIGURATION_FLAGS = {
"configureExtensionsAutomaticallyIgnoreList",
enableCodeLens: "enableCodeLens",
showToolVersionsDecorations: "showToolVersionsDecorations",
showOutdatedToolGutterDecorations: "showOutdatedToolGutterDecorations",
checkForNewMiseVersion: "checkForNewMiseVersion",
updateEnvAutomatically: "updateEnvAutomatically",
updateOpenTerminalsEnvAutomatically: "updateOpenTerminalsEnvAutomatically",
Expand Down Expand Up @@ -101,6 +102,13 @@ export const shouldShowToolVersionsDecorations = () => {
return getConfOrElse(CONFIGURATION_FLAGS.showToolVersionsDecorations, true);
};

export const shouldShowOutdatedToolGutterDecorations = () => {
return getConfOrElse(
CONFIGURATION_FLAGS.showOutdatedToolGutterDecorations,
true,
);
};

export const shouldCheckForNewMiseVersion = () => {
return getConfOrElse(CONFIGURATION_FLAGS.checkForNewMiseVersion, true);
};
Expand Down
15 changes: 11 additions & 4 deletions src/miseExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
registerEnvsCommands,
updateEnv,
} from "./providers/envProvider";
import { showToolVersionInline } from "./providers/inlineToolDecorator";
import { addToolInfoToEditor } from "./providers/inlineToolDecorator";
import { MiseCompletionProvider } from "./providers/miseCompletionProvider";
import { MiseFileTaskCodeLensProvider } from "./providers/miseFileTaskCodeLensProvider";
import {
Expand Down Expand Up @@ -277,12 +277,18 @@ export class MiseExtension {
event.document === vscode.window.activeTextEditor?.document &&
event.document.languageId === "toml"
) {
showToolVersionInline(event.document, this.miseService);
addToolInfoToEditor(event.document, this.miseService, context);
}
}),
vscode.window.onDidChangeActiveTextEditor((editor) => {
if (editor && editor.document.languageId === "toml") {
showToolVersionInline(editor.document, this.miseService);
addToolInfoToEditor(editor.document, this.miseService, context);
}
}),
vscode.window.onDidChangeActiveColorTheme(() => {
const editor = vscode.window.activeTextEditor;
if (editor && editor.document.languageId === "toml") {
addToolInfoToEditor(editor.document, this.miseService, context);
}
}),
vscode.workspace.onDidSaveTextDocument((document) => {
Expand All @@ -293,9 +299,10 @@ export class MiseExtension {
);

if (vscode.window.activeTextEditor?.document.languageId === "toml") {
void showToolVersionInline(
void addToolInfoToEditor(
vscode.window.activeTextEditor?.document,
this.miseService,
context,
);
}

Expand Down
Loading

0 comments on commit e1d761d

Please sign in to comment.