JonasGruenwald / code-livebook

VSCode Extension to open Elixir LiveBooks
https://marketplace.visualstudio.com/items?itemName=jonasgruenwald.code-livebook
Other
2 stars 0 forks source link

Support use of relative path for `livebook` #1

Open svallory opened 1 month ago

svallory commented 1 month ago

Hi!

I'm using devbox and I have livebook installed at ./.nix-mix/escripts but I can't get the extension to run livebook from there (without using a full path. I've tried setting code-livebook.livebookExecutablePath to

None worked.

This is not related to devbox, but in case it makes it easier for you to the debug the issue, here's my devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.0/.schema/devbox.schema.json",
  "packages": [
    "elixir@latest",
    "bash@latest",
    "zsh@latest",
    "xz@latest",
    "zig@latest",
    "_7zz@latest",
    "erlang@latest",
    "lexical@latest"
  ],
  "env": {
    "MIX_HOME":               "$PWD/.nix-mix",
    "HEX_HOME":               "$PWD/.nix-hex",
    "ERL_AFLAGS":             "-kernel shell_history enabled",
    "SPACESHIP_PROMPT_ASYNC": "false"
  },
  "shell": {
    "init_hook": [
      "mkdir -p .nix-mix",
      "mkdir -p .nix-hex",
      "mix local.hex --force",
      "mix local.rebar --force",
      "export PATH=\"$PATH:$MIX_HOME/escripts\""
    ],
    "scripts": {
      "test":  "mix run",
      "build": "mix burrito.build --release uisl"
    }
  }
}
JonasGruenwald commented 1 month ago

Hello!

Supporting relative paths, or this ${workspaceFolder} pattern seems like a good idea, I don't have time to look into this at the moment but I could merge a PR if you want to make one.

The relevant part is here: https://github.com/JonasGruenwald/code-livebook/blob/main/src/liveBookServer.ts#L37

There might be a vscode API to support this ${workspaceFolder} interpolation if other extensions allow it