Skip to content

Commit

Permalink
fix: auto-save before running a task
Browse files Browse the repository at this point in the history
  • Loading branch information
hverlin committed Nov 14, 2024
1 parent caf68aa commit 8104fc2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ VS Code extension for [mise](https://mise.jdx.dev/)

> [mise](https://mise.jdx.dev/) is a development environment setup tool that manages your project's tools, runtimes, environment variables, and tasks all in one place.
![mise-extension.png](screenshots/mise-extension.png)

## 📥 Installation
- [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=hverlin.mise-vscode)
- [Open VSX Registry](https://open-vsx.org/extension/hverlin/mise-vscode)
Expand All @@ -15,10 +17,10 @@ VS Code extension for [mise](https://mise.jdx.dev/)
### Task Management
- 🔍 Automatic detection of [mise tasks](https://mise.jdx.dev/tasks/)
- ⚡ Run tasks directly from:
- `mise.toml` files
- `mise.toml` files or file tasks
- Command palette
- Mise sidebar
- Arguments are supported!
- Arguments are supported!
- 📝 View task definitions
- ➕ Create new file tasks

Expand Down
Binary file added screenshots/mise-extension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export async function activate(context: vscode.ExtensionContext) {

context.subscriptions.push(
vscode.commands.registerCommand("mise.refreshEntry", async () => {
await initializeMisePath();

const miseProfile = vscode.workspace
.getConfiguration("mise")
.get("profile");
Expand Down
2 changes: 0 additions & 2 deletions src/providers/miseFileTaskCodeLensProvider.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as path from "node:path";
import * as vscode from "vscode";
import { isExecutable } from "../utils/fileUtils";
import { logger } from "../utils/logger";
import { RUN_TASK_COMMAND, WATCH_TASK_COMMAND } from "./tasksProvider";

export class MiseFileTaskCodeLensProvider implements vscode.CodeLensProvider {
public async provideCodeLenses(
document: vscode.TextDocument,
): Promise<vscode.CodeLens[]> {
const codeLenses: vscode.CodeLens[] = [];
logger.info(`provideCodeLenses: ${document.fileName}`);
if (!(await isExecutable(document.fileName))) {
return [];
}
Expand Down
4 changes: 4 additions & 0 deletions src/providers/tasksProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ export function registerTasksCommands(
vscode.commands.registerCommand(
RUN_TASK_COMMAND,
async (taskName: undefined | string | MiseTask | TaskItem) => {
await vscode.workspace.saveAll(false);

let name = taskName;
if (!name) {
name = await vscode.window.showQuickPick(
Expand All @@ -320,6 +322,8 @@ export function registerTasksCommands(
vscode.commands.registerCommand(
WATCH_TASK_COMMAND,
async (taskName: undefined | string | MiseTask | TaskItem) => {
await vscode.workspace.saveAll(false);

let name = taskName;
if (!name) {
name = await vscode.window.showQuickPick(
Expand Down

0 comments on commit 8104fc2

Please sign in to comment.