Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flox.edit command (opens manifest.toml) #23

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Flox VSCode Extention

## Quick Start
Ensure you have "Extension Test Runner" installed in your VSCode.
It should be a recommended extension for a blank VSCode installation.

```console
$ cd git clone [email protected]/flox/flox-vscode.git;
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
"category": "Flox",
"icon": "$(trash)",
"title": "Uninstall a package"
},
{
"command": "flox.edit",
"category": "Flox",
"title": "Edit manifest.toml"
}
],
"menus": {
Expand Down Expand Up @@ -150,8 +155,8 @@
"scripts": {
"vscode:prepublish": "npm run compile",
"package": "vsce package --allow-star-activation",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"compile": "tsc -p ./ && mkdir -p out/assets && cp assets/* out/assets",
"watch": "mkdir -p out/assets && cp assets/* out/assets && tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src",
"test": "vscode-test"
Expand Down
16 changes: 16 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,20 @@ export async function activate(context: vscode.ExtensionContext) {

});

env.registerCommand('flox.edit', async () => {
if (env.workspaceUri === undefined) {
return
}

const manifestUri = vscode.Uri.joinPath(env.workspaceUri, ".flox", "env", "manifest.toml");
env.displayMsg("Opening manifest.toml");

try {
const doc = await vscode.workspace.openTextDocument(manifestUri);
await vscode.window.showTextDocument(doc);
} catch (error) {
env.displayError(`Something went wrong when opening manifest.toml: ${error}`);
}
});

}
Loading