Open pachi opened 10 months ago
Couldn't typstfmt looks recursively for a config file in parent directories ? And maybe stop when it's at the root of a git repo if you don't want it go look toor far ? I have a project with tons of typst files within sub-directories and still would like a project-based config file (but not a global one).
As the issue mentions, the cli handles it well, it's typst lsp that is missing this feature, so this issue should be transferred to typst-lsp instead
We already have a good config setup for typstfmt (local to projects or global to user are supported)
[ x] I have tested with the master version of typstfmt and not just typst-lsp
Describe the bug
typstfmt doesn't read a config file in the same folder as the formatted document.
To Reproduce Steps to reproduce the behavior:
I create a typstfmt.toml file to apply custom formatting options (for instance, line_wrap = false) alongside my document.typ file.
If I have the standalone CLI in the project folder this works perfectly as it reads its config from there. If I put the typstfmt executable in the parent dir of the project and retry then it ignores those settings.
So... it loads the settings if they're in the same folder as the executable itself, but it doesn't try to read (and use with preference) a config from the project dir (as I would expect).
There's an option to show the global config file, and it's located by default in a user settings folder, but this should be the default settings for that user to override the application default settings.
Proposed behaviour
IMHO, typstfmt should look for, in this order, 1) a config in the formatted document dir, then 2) in the user config dir (that's reported as global config path) then 3) a config besides the CLI and, finally, 3) the default settings.