diff --git a/package.json b/package.json index e64d41d..3c6824f 100644 --- a/package.json +++ b/package.json @@ -504,7 +504,7 @@ }, "devDependencies": { "@biomejs/biome": "1.9.4", - "@rsbuild/core": "^1.1.0", + "@rsbuild/core": "^1.1.6", "@rsbuild/plugin-react": "^1.0.7", "@types/node": "^22.9.0", "@types/react": "^18.3.12", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e0476d..166904c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,11 +49,11 @@ importers: specifier: 1.9.4 version: 1.9.4 '@rsbuild/core': - specifier: ^1.1.0 - version: 1.1.0 + specifier: ^1.1.6 + version: 1.1.6 '@rsbuild/plugin-react': specifier: ^1.0.7 - version: 1.0.7(@rsbuild/core@1.1.0) + version: 1.0.7(@rsbuild/core@1.1.6) '@types/node': specifier: ^22.9.0 version: 22.9.0 @@ -155,8 +155,8 @@ packages: '@module-federation/webpack-bundler-runtime@0.5.1': resolution: {integrity: sha512-mMhRFH0k2VjwHt3Jol9JkUsmI/4XlrAoBG3E0o7HoyoPYv1UFOWyqAflfANcUPgbYpvqmyLzDcO+3IT36LXnrA==} - '@rsbuild/core@1.1.0': - resolution: {integrity: sha512-SyQlJjWgR1VwLt4nuiY0g6L9INv2koH232TeDZuopvNgbRytskD3kJ8bbGWBBXsQjZjtqBEh5ishqf8CIfF8dQ==} + '@rsbuild/core@1.1.6': + resolution: {integrity: sha512-u9Elj+xfgIPRD8rEXioE6xBJOdEGt0Pw1iJiGm/gU28FmH3QmOEFq2Jvo70RsOISNOy18kEM9y0RsqVgtVrpNw==} engines: {node: '>=16.7.0'} hasBin: true @@ -165,56 +165,56 @@ packages: peerDependencies: '@rsbuild/core': 1.x - '@rspack/binding-darwin-arm64@1.1.0': - resolution: {integrity: sha512-02YmzmtKMNHCSMzVT5sgbJuPDn+HunkrtWq0D95Fh9sGKYap9cs0JOpzTfyAL3KXJ9JzVfOAZA3VgVQOBaQNWQ==} + '@rspack/binding-darwin-arm64@1.1.4': + resolution: {integrity: sha512-mSN9OWvenbD125THkj3nFOlJCk5o44C8uc0YH7gK1uR77g98USiC/4eSWXKqP+sRfDBplQEzannuPrBW1nPimQ==} cpu: [arm64] os: [darwin] - '@rspack/binding-darwin-x64@1.1.0': - resolution: {integrity: sha512-HtBh8p6hml7BWNtZaqWFtGbOFP/tvFDn1uPWmA3R32WTILUXNRWXIsLDY95U3Z2U1Gt3SL58SOpJjXlFIb6wZg==} + '@rspack/binding-darwin-x64@1.1.4': + resolution: {integrity: sha512-ECmcTJecXwqhqqpOjfjIcwDp8UqJ3D1Crc2COG+wUfwejtbqs9twUTaufZz7U7xna+oyfJ4GRNSKS9xs4N2kPQ==} cpu: [x64] os: [darwin] - '@rspack/binding-linux-arm64-gnu@1.1.0': - resolution: {integrity: sha512-Q/i50Pieii3akdv5Q6my6QelV5Dpc8O/Ir4udpjYl0pbSdKamdI8M85fxrMxGAGcoNSD+X52fDvxJujXWMcP0w==} + '@rspack/binding-linux-arm64-gnu@1.1.4': + resolution: {integrity: sha512-QVRFV6+z1DopeGn8rLRbBNrWXuBvp7J19lTtvx9F5mItzTiBVHmNqFt31namm59xkhHJ3leng7l2F39qcOMOIA==} cpu: [arm64] os: [linux] - '@rspack/binding-linux-arm64-musl@1.1.0': - resolution: {integrity: sha512-H7Eu3xC7LWPpxrI47n8X361eEGGpQOjZIWTz8tLdn4oNS2D9kqsBYES7LsuuLTTH4ueHTDuEtDdfZpBsE+qesw==} + '@rspack/binding-linux-arm64-musl@1.1.4': + resolution: {integrity: sha512-UCateQWfEpEyFOC/tkuicXpIm81s5DavcwKjX3wwh1JB/KO6UxGHK8F75BV4K3Coo/UEiNCvL8xrB7eDjMDwYg==} cpu: [arm64] os: [linux] - '@rspack/binding-linux-x64-gnu@1.1.0': - resolution: {integrity: sha512-dIZSutPo2z/OaO2f6SVlcYA6lGBH+4TrRtWmMyPshpTNPrkCGGfDhC43fZ4jCiUj2PO/Hcn8jyKhci4leBsVBA==} + '@rspack/binding-linux-x64-gnu@1.1.4': + resolution: {integrity: sha512-Nz5Bt1PDxebVRU321h9AGkLRQL5n9Xgt+rluWAXLVtyxM9aPavmvu1n6/G9stXwQdnUVrZIUs7EzhIhWBe5R/A==} cpu: [x64] os: [linux] - '@rspack/binding-linux-x64-musl@1.1.0': - resolution: {integrity: sha512-f6L2JWgbG9PKWnVw2YNZdntjzia1V2w2Xq458HkCQUDwhnEipWXaZ2zhfD9jcb4UYoMP8/2uD3B96sSFFNTdrQ==} + '@rspack/binding-linux-x64-musl@1.1.4': + resolution: {integrity: sha512-1XG795a+M4vE7JLyeDa1oktr4WU/I5IQ9d8Vk3PVtF59IxnKpjOb3vdGhXP7Ke2zWP6C2YQzWotez6AbO3uWeA==} cpu: [x64] os: [linux] - '@rspack/binding-win32-arm64-msvc@1.1.0': - resolution: {integrity: sha512-opo6XR4iXh/QkHiauVQBlU2xR2JyjDmSwgkION27oszu81nr+IajTSXQX96x5I6Bq48GQLU4rItHse/doctQDA==} + '@rspack/binding-win32-arm64-msvc@1.1.4': + resolution: {integrity: sha512-1hXOgHxnrBmjBNUluy9MbFMQi4lnAS199JD5UHRc2mx5i+D8cjAiBsWHzIcK4xzsxu2IYgVGsJcdIA8/zV/PVQ==} cpu: [arm64] os: [win32] - '@rspack/binding-win32-ia32-msvc@1.1.0': - resolution: {integrity: sha512-FBcG+OPJokSE3nPi1+ZamLK2V4IWdNC+GMr0z7LUrBiKc5lO70y5VkldfyPV1Z+doSuroVINlhK+lRHdQgGwYg==} + '@rspack/binding-win32-ia32-msvc@1.1.4': + resolution: {integrity: sha512-Jfq6gF5QKOYZsgDYRx+fWipDHmtHxq6jniws1WAE8F5w1qIt/dAHzW3a6+3VwCih9lQEEH3Rimy/ECB0oergng==} cpu: [ia32] os: [win32] - '@rspack/binding-win32-x64-msvc@1.1.0': - resolution: {integrity: sha512-H/6Glp1nZvxWAD5+2hRrp1kBs9f+pLb/un2TdFSUNd2tyXq5GyHCe70+N9psbe/jjGxD8e1vPNQtN/VvkuR0Zg==} + '@rspack/binding-win32-x64-msvc@1.1.4': + resolution: {integrity: sha512-d9HUGVfNFhB+r32kDPkzHeMmgwemTFsDymnWJUgUrojzTJ326JrDmEXVeCnAHfwBSC9w4/mp4H+4iGhIdKSo9w==} cpu: [x64] os: [win32] - '@rspack/binding@1.1.0': - resolution: {integrity: sha512-zLduWacrw/bBYiFvhjN70f+AJxXnTzevywXp54vso8d0Nz7z4KIycdz/Ua5AGRUkG2ZuQw6waypN5pXf48EBcA==} + '@rspack/binding@1.1.4': + resolution: {integrity: sha512-XdR/4DACpLqNjxEw+ikg5FN2dQbOAxj7fDlndNio0l+m8ThPiIsetkJ2FNSlxt/K4SVnIrwAkhE5kabVNKR4EA==} - '@rspack/core@1.1.0': - resolution: {integrity: sha512-+IYWSe9D3wB97VVBfaojuWLv3wGIBe9pfJkxNObkorN60Nj3UHYzBLuACrHn4hW2mZjAWrv06ReHXJUEGzQqaQ==} + '@rspack/core@1.1.4': + resolution: {integrity: sha512-JUU1pS11TY3/MwnezBfLLp3+7zfkd4Adzo8Pv4f4R1KoJyX1FYBFBcKnfZBlaGYi2C2e5ZDrrHxQlrPmygjbuw==} engines: {node: '>=16.0.0'} peerDependencies: '@swc/helpers': '>=0.5.1' @@ -348,11 +348,6 @@ packages: error-stack-parser@2.1.4: resolution: {integrity: sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==} - fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - html-entities@2.5.2: resolution: {integrity: sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==} @@ -544,64 +539,62 @@ snapshots: '@module-federation/runtime': 0.5.1 '@module-federation/sdk': 0.5.1 - '@rsbuild/core@1.1.0': + '@rsbuild/core@1.1.6': dependencies: - '@rspack/core': 1.1.0(@swc/helpers@0.5.15) + '@rspack/core': 1.1.4(@swc/helpers@0.5.15) '@rspack/lite-tapable': 1.0.1 '@swc/helpers': 0.5.15 core-js: 3.39.0 - optionalDependencies: - fsevents: 2.3.3 - '@rsbuild/plugin-react@1.0.7(@rsbuild/core@1.1.0)': + '@rsbuild/plugin-react@1.0.7(@rsbuild/core@1.1.6)': dependencies: - '@rsbuild/core': 1.1.0 + '@rsbuild/core': 1.1.6 '@rspack/plugin-react-refresh': 1.0.0(react-refresh@0.14.2) react-refresh: 0.14.2 - '@rspack/binding-darwin-arm64@1.1.0': + '@rspack/binding-darwin-arm64@1.1.4': optional: true - '@rspack/binding-darwin-x64@1.1.0': + '@rspack/binding-darwin-x64@1.1.4': optional: true - '@rspack/binding-linux-arm64-gnu@1.1.0': + '@rspack/binding-linux-arm64-gnu@1.1.4': optional: true - '@rspack/binding-linux-arm64-musl@1.1.0': + '@rspack/binding-linux-arm64-musl@1.1.4': optional: true - '@rspack/binding-linux-x64-gnu@1.1.0': + '@rspack/binding-linux-x64-gnu@1.1.4': optional: true - '@rspack/binding-linux-x64-musl@1.1.0': + '@rspack/binding-linux-x64-musl@1.1.4': optional: true - '@rspack/binding-win32-arm64-msvc@1.1.0': + '@rspack/binding-win32-arm64-msvc@1.1.4': optional: true - '@rspack/binding-win32-ia32-msvc@1.1.0': + '@rspack/binding-win32-ia32-msvc@1.1.4': optional: true - '@rspack/binding-win32-x64-msvc@1.1.0': + '@rspack/binding-win32-x64-msvc@1.1.4': optional: true - '@rspack/binding@1.1.0': + '@rspack/binding@1.1.4': optionalDependencies: - '@rspack/binding-darwin-arm64': 1.1.0 - '@rspack/binding-darwin-x64': 1.1.0 - '@rspack/binding-linux-arm64-gnu': 1.1.0 - '@rspack/binding-linux-arm64-musl': 1.1.0 - '@rspack/binding-linux-x64-gnu': 1.1.0 - '@rspack/binding-linux-x64-musl': 1.1.0 - '@rspack/binding-win32-arm64-msvc': 1.1.0 - '@rspack/binding-win32-ia32-msvc': 1.1.0 - '@rspack/binding-win32-x64-msvc': 1.1.0 - - '@rspack/core@1.1.0(@swc/helpers@0.5.15)': + '@rspack/binding-darwin-arm64': 1.1.4 + '@rspack/binding-darwin-x64': 1.1.4 + '@rspack/binding-linux-arm64-gnu': 1.1.4 + '@rspack/binding-linux-arm64-musl': 1.1.4 + '@rspack/binding-linux-x64-gnu': 1.1.4 + '@rspack/binding-linux-x64-musl': 1.1.4 + '@rspack/binding-win32-arm64-msvc': 1.1.4 + '@rspack/binding-win32-ia32-msvc': 1.1.4 + '@rspack/binding-win32-x64-msvc': 1.1.4 + + '@rspack/core@1.1.4(@swc/helpers@0.5.15)': dependencies: '@module-federation/runtime-tools': 0.5.1 - '@rspack/binding': 1.1.0 + '@rspack/binding': 1.1.4 '@rspack/lite-tapable': 1.0.1 caniuse-lite: 1.0.30001680 optionalDependencies: @@ -751,9 +744,6 @@ snapshots: dependencies: stackframe: 1.3.4 - fsevents@2.3.3: - optional: true - html-entities@2.5.2: {} htmlparser2@9.1.0: diff --git a/src/miseFileWatcher.ts b/src/miseFileWatcher.ts index e7312e1..39300c7 100644 --- a/src/miseFileWatcher.ts +++ b/src/miseFileWatcher.ts @@ -4,7 +4,7 @@ import type { MiseService } from "./miseService"; import { logger } from "./utils/logger"; import { allowedFileTaskDirs, - legacyFiles, + idiomaticFiles, misePatterns, } from "./utils/miseUtilts"; @@ -51,7 +51,7 @@ export class MiseFileWatcher { this.fileWatchers.push( vscode.workspace.createFileSystemWatcher( - new vscode.RelativePattern(rootFolder, `{${legacyFiles}}`), + new vscode.RelativePattern(rootFolder, `{${idiomaticFiles}}`), ), ); diff --git a/src/miseService.ts b/src/miseService.ts index 8c8a48a..702d995 100644 --- a/src/miseService.ts +++ b/src/miseService.ts @@ -17,6 +17,7 @@ import { uniqBy } from "./utils/fn"; import { logger } from "./utils/logger"; import { resolveMisePath } from "./utils/miseBinLocator"; import { type MiseConfig, parseMiseConfig } from "./utils/miseDoctorParser"; +import { idiomaticFileToTool, idiomaticFiles } from "./utils/miseUtilts"; import { showSettingsNotification } from "./utils/notify"; import { execAsync, execAsyncMergeOutput } from "./utils/shell"; import { type MiseTaskInfo, parseTaskInfo } from "./utils/taskInfoParser"; @@ -690,8 +691,25 @@ export class MiseService { const content = await vscode.workspace.fs.readFile( vscode.Uri.file(trackedConfigPath), ); - const config = parse(content.toString()); - return { path: trackedConfigPath, tools: config.tools ?? {} }; + if (trackedConfigPath.endsWith(".toml")) { + const config = parse(content.toString()); + return { path: trackedConfigPath, tools: config.tools ?? {} }; + } + const idiomaticFile = [...idiomaticFiles].find((ext) => + trackedConfigPath.endsWith(ext), + ); + if (idiomaticFile) { + return { + path: trackedConfigPath, + tools: { + // @ts-ignore + [idiomaticFileToTool[idiomaticFile]]: content + .toString() + .trim(), + }, + }; + } + return { path: trackedConfigPath, tools: {} }; } } catch { return {}; @@ -736,12 +754,12 @@ export class MiseService { : this.runMiseToolActionInConsole("prune --dry-run"); } - async upgradeToolInConsole(toolName: string, version: string) { + async upgradeToolInConsole(toolName: string) { if (!this.getMiseBinaryPath()) { return; } - await this.runMiseToolActionInConsole(`up ${toolName}@${version}`); + await this.runMiseToolActionInConsole(`up ${toolName}`); } async installToolInConsole(toolName: string, version: string) { diff --git a/src/providers/envProvider.ts b/src/providers/envProvider.ts index 79f6f56..43c9972 100644 --- a/src/providers/envProvider.ts +++ b/src/providers/envProvider.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; import { isMiseExtensionEnabled } from "../configuration"; import type { MiseService } from "../miseService"; +import { logger } from "../utils/logger"; import { findEnvVarPosition } from "../utils/miseFileParser"; export class MiseEnvsProvider implements vscode.TreeDataProvider { @@ -130,7 +131,7 @@ export function registerEnvsCommands( vscode.commands.registerCommand( "mise.setEnvVariable", async (filePath: string | undefined) => { - let selectedPath = filePath; + let selectedPath = filePath?.trim?.(); if (!selectedPath) { selectedPath = await vscode.window.showQuickPick( await miseService.getMiseTomlConfigFilePathsEvenIfMissing(), @@ -142,6 +143,7 @@ export function registerEnvsCommands( return; } + logger.info(`Selected path: ${selectedPath}`); const environmentVariableName = await vscode.window.showInputBox({ placeHolder: "Environment variable name", }); diff --git a/src/providers/tasksProvider.ts b/src/providers/tasksProvider.ts index e28958b..53e758b 100644 --- a/src/providers/tasksProvider.ts +++ b/src/providers/tasksProvider.ts @@ -10,7 +10,7 @@ import type { MiseService } from "../miseService"; import { expandPath, setupMiseToml, setupTaskFile } from "../utils/fileUtils"; import { logger } from "../utils/logger"; import { findTaskPosition } from "../utils/miseFileParser"; -import { allowedFileTaskDirs, legacyFiles } from "../utils/miseUtilts"; +import { allowedFileTaskDirs, idiomaticFiles } from "../utils/miseUtilts"; import { execAsync } from "../utils/shell"; import type { MiseTaskInfo } from "../utils/taskInfoParser"; @@ -52,7 +52,7 @@ export class MiseTasksProvider implements vscode.TreeDataProvider { const configFiles = await this.miseService.getMiseConfigFiles(); const groupedTasks = this.groupTasksBySource(tasks); for (const configFile of configFiles) { - if (legacyFiles.has(path.basename(configFile.path))) { + if (idiomaticFiles.has(path.basename(configFile.path))) { continue; } diff --git a/src/utils/miseUtilts.ts b/src/utils/miseUtilts.ts index 6ecc1c8..e4e3dc9 100644 --- a/src/utils/miseUtilts.ts +++ b/src/utils/miseUtilts.ts @@ -28,20 +28,23 @@ export const misePatterns = [ ".mise.*.local.toml", ].join(","); -export const legacyFiles = new Set([ - ".crystal-version", - ".exenv-version", - ".go-version", - "go.mod", - ".java-version", - ".sdkmanrc", - ".nvmrc", - ".node-version", - ".python-version", - ".ruby-version", - "Gemfile", - ".terraform-version", - ".packer-version", - "main.tf", - ".yarnrc", -]); +export const idiomaticFileToTool = { + ".crystal-version": "crystal", + ".exenv-version": "elixir", + ".go-version": "go", + "go.mod": "go", + ".java-version": "java", + ".sdkmanrc": "java", + ".nvmrc": "node", + ".node-version": "node", + ".python-version": "python", + ".python-versions": "python", + ".ruby-version": "ruby", + Gemfile: "ruby", + ".terraform-version": "terraform", + ".packer-version": "packer", + "main.tf": "terraform", + ".yarnrc": "yarn", +} as const; + +export const idiomaticFiles = new Set(Object.keys(idiomaticFileToTool)); diff --git a/src/webviewPanel.ts b/src/webviewPanel.ts index d9d3af5..8d2da96 100644 --- a/src/webviewPanel.ts +++ b/src/webviewPanel.ts @@ -129,10 +129,7 @@ export default class WebViewPanel { } case "upgradeTool": { return executeAction(message, async () => - miseService.upgradeToolInConsole( - message.mutationKey[1], - message.mutationKey[2], - ), + miseService.upgradeToolInConsole(message.mutationKey[1]), ); } case "installTool": { diff --git a/src/webviews/App.tsx b/src/webviews/App.tsx index 532c4ef..4448da6 100644 --- a/src/webviews/App.tsx +++ b/src/webviews/App.tsx @@ -26,7 +26,7 @@ export function App() { icon: "codicon codicon-settings", }, { - name: "Config files", + name: "Tracked Configs", content: , icon: "codicon codicon-file", }, diff --git a/src/webviews/components/CustomTable.tsx b/src/webviews/components/CustomTable.tsx index f5d2ed0..c77c603 100644 --- a/src/webviews/components/CustomTable.tsx +++ b/src/webviews/components/CustomTable.tsx @@ -99,7 +99,8 @@ export default function CustomTable({ bordered-columns // @ts-ignore zebra - style={{ maxHeight: "100dvh" }} + responsive + breakpoint={400} > {table.getHeaderGroups().map((headerGroup) => (