Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ You can configure the extension using the following settings:
- `marimo.browserType`: Browser to open marimo app (`system` or `embedded`, default: `embedded`)
- `marimo.port`: Default port for marimo server (default: `2818`)
- `marimo.sandbox`: Always start marimo in a sandbox, e.g. `marimo edit --sandbox` (default: `false`). Requires [`uv`](https://docs.astral.sh/uv/) to be installed.
- `marimo.watch`: Always start marimo with the `--watch` flag (default: `true`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! this is a great addition and good default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for doing the main implementation!

- `marimo.host`: Hostname for marimo server (default: `localhost`)
- `marimo.https`: Enable HTTPS for marimo server (default: `false`)
- `marimo.enableToken`: Enable token authentication (default: `false`)
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@
"default": false,
"description": "Whether to always start marimo in a sandbox. Requires `uv` to be installed."
},
"marimo.watch": {
"type": "boolean",
"default": true,
"description": "Whether to always start marimo with the --watch flag."
},
"marimo.https": {
"type": "boolean",
"default": false,
Expand Down
9 changes: 9 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Config {
readonly tokenPassword: string | undefined;
readonly https: boolean;
readonly sandbox: boolean;
readonly watch: boolean;
}

/**
Expand Down Expand Up @@ -131,6 +132,14 @@ export const Config = {
get sandbox(): boolean {
return getConfig("sandbox", false);
},

/**
* Whether to always start marimo with the --watch flag.
* @default true
*/
get watch(): boolean {
return getConfig("watch", true);
},
};

export async function composeUrl(port: number): Promise<string> {
Expand Down
1 change: 1 addition & 0 deletions src/services/server-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export class ServerManager implements IServerManager {
.enableToken(this.config.enableToken)
.tokenPassword(this.config.tokenPassword)
.sandbox(this.config.sandbox)
.watch(this.config.watch)
.build();
}

Expand Down
16 changes: 16 additions & 0 deletions src/utils/__tests__/cmd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,20 @@ describe("MarimoCmdBuilder", () => {
`"marimo --yes edit path/to/file --host=localhost --port=2718 --headless --no-token --sandbox"`,
);
});

it("should support watch mode", () => {
const cmd = new MarimoCmdBuilder()
.debug(false)
.mode("edit")
.fileOrDir("path/to/file")
.host("localhost")
.port(2718)
.headless(true)
.enableToken(false)
.watch(true)
.build();
expect(cmd).toMatchInlineSnapshot(
`"marimo --yes edit path/to/file --host=localhost --port=2718 --headless --no-token --watch"`,
);
});
});
7 changes: 7 additions & 0 deletions src/utils/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export class MarimoCmdBuilder {
return this;
}

watch(value: boolean) {
if (value) {
this.cmd.push("--watch");
}
return this;
}

build() {
return this.cmd.join(" ");
}
Expand Down
Loading