aboutsummaryrefslogtreecommitdiff
path: root/docs/api/utils.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api/utils.md')
-rw-r--r--docs/api/utils.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/api/utils.md b/docs/api/utils.md
index dcd9c0128..ce3d0d6f9 100644
--- a/docs/api/utils.md
+++ b/docs/api/utils.md
@@ -118,3 +118,29 @@ test("peek.status", () => {
expect(peek.status(rejected)).toBe("rejected");
});
```
+
+## `Bun.openInEditor`
+
+Open a file in your default editor. Bun auto-detects your editor via the `$VISUAL` or `$EDITOR` environment variables.
+
+```ts
+const currentFile = import.meta.url;
+Bun.openInEditor(currentFile);
+```
+
+You can override this via the `debug.editor` setting in your [`bunfig.toml`](/docs/project/configuration)
+
+```toml-diff#bunfig.toml
++ [debug]
++ editor = "code"
+```
+
+Or specify an editor with the `editor` param. You can also specify a line and column number.
+
+```ts
+Bun.openInEditor(import.meta.url, {
+ editor: "vscode", // or "subl"
+ line: 10,
+ column: 5,
+})
+```