I'm using a custom .helix/languages.toml for a monorepo setup. I don't want to use a global prettier bin, but rather the one installed in the currently worked on package. This is my config:
[[language]]
name = "typescript"
scope = "source.ts"
file-types = ["ts", "mts", "cts"]
injection-regex = "(ts|typescript)"
roots = ["package.json"]
language-servers = [{ except-features = ["format"], name = "typescript-language-server" }]
formatter = { command = "pnpm", args = ["prettier", "--parser", "typescript"] }
auto-format = true
However, this doesn't work if I open Helix from the monorepo root, as there's no package.json there and pnpm prettier fails. Maybe I'm misunderstanding how the workspace roots work, but I don't think the formatter is using these either. I ran pwd and see it's just the folder I opened Helix from.
formatter = { command = "pwd" }
Even if I installed a global prettier, it won't be using the correct .prettierignore and .prettierrc.yml. I would like the option of running the formatter from the working directory of the currently open file.
I'm using a custom
.helix/languages.tomlfor a monorepo setup. I don't want to use a globalprettierbin, but rather the one installed in the currently worked on package. This is my config:However, this doesn't work if I open Helix from the monorepo root, as there's no
package.jsonthere andpnpm prettierfails. Maybe I'm misunderstanding how the workspace roots work, but I don't think the formatter is using these either. I ranpwdand see it's just the folder I opened Helix from.Even if I installed a global prettier, it won't be using the correct
.prettierignoreand.prettierrc.yml. I would like the option of running the formatter from the working directory of the currently open file.