Skip to content

Commit

Permalink
init: edit
Browse files Browse the repository at this point in the history
  • Loading branch information
tomberek committed Jan 10, 2025
1 parent 49864a6 commit 063870a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
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
4 changes: 2 additions & 2 deletions package-lock.json

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

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
14 changes: 14 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from 'vscode';
import Env from './env';
import { HelpView, InstallView, Package } from './view';
import * as path from 'path';

export async function activate(context: vscode.ExtensionContext) {

Expand Down Expand Up @@ -196,4 +197,17 @@ export async function activate(context: vscode.ExtensionContext) {

});

env.registerCommand('flox.edit', async () => {
// This cwd is not recommended for extensions to use
const filePath = path.join(process.cwd(),'.flox','env','manifest.toml');
env.displayError('Opening: ' + filePath);
const openPath = vscode.Uri.file(filePath);
try {
const doc = await vscode.workspace.openTextDocument(openPath);
await vscode.window.showTextDocument(doc);
} catch (error) {
env.displayError('Error:' + error);
}
});

}

0 comments on commit 063870a

Please sign in to comment.