Currently, the format_on_save external command option is difficult to set up in monorepos due to the default working directory being in the project root, instead of the containing directory of the .zed folder. Consider the following:
Ideally, the current working directory would default to the directory containing the .zed/settings.json file in which the external command is configured, or failing this, it should be configurable.
If applicable, add mockups / screenshots to help present your vision of the feature
If the default working directory were changed to be the containing folder of the .zed/settings.json file, then no new config options would be required.
If configurable working directories were to be introduced, this could be done as follows:
"format_on_save": {
"external": {
"working_directory": "{local_config_root}", // Where `{local_config_root}` is `<project_root>/apps/some_app`
"working_directory": "{global_config_root}", // Where `{global_config_root}` is `<project_root>`
"working_directory": "./some/sub/directory", // Resolves to "{local_config_root}/some/sub/directory" or "{global_config_root}/some/sub/directory" depending on default
"command": "...",
"arguments": ["..."]
}
}
Check for existing issues
Describe the feature
Currently, the format_on_save external command option is difficult to set up in monorepos due to the default working directory being in the project root, instead of the containing directory of the
.zed
folder. Consider the following:If I am using an external formatting tool in
some_app
(e.g. prettier) then I likely need to run that tool withapps/some_app
as the working directory.Intuitively, I would set this up as follows:
(yes, I'm using prettier to format blade files... don't ask!)
Because the default file path is not set correctly, I need to use the following counterintuitive workaround:
Ideally, the current working directory would default to the directory containing the
.zed/settings.json
file in which the external command is configured, or failing this, it should be configurable.If applicable, add mockups / screenshots to help present your vision of the feature
If the default working directory were changed to be the containing folder of the
.zed/settings.json
file, then no new config options would be required.If configurable working directories were to be introduced, this could be done as follows: