Open cameronhunter opened 1 year ago
Is your configuration in a sub directory and called either “dprint.json” or “.dprint.json”? If so, it should just work for that sub directory.
Thanks for the quick response. Our dprint.json
config file is in a directory such as tools/config/formatting/
I think it should just automatically pick that up in that case and use that config. You can see in "View > Output" then select "dprint" in the drop down of the output window. It should show all the folders it got initialized in.
Oh wait, I think I misunderstood. You want it to use the configuration in /your-project/tools/config/formatting/
for the /your-project/
directory? The above will only use it in /your-project/tools/config/formatting/
.
I'm not sure I want to support having configurations in non-standard sub directories because it adds more complexity and maintenance overhead (ex. need to define "use this config for this folder and this config for that folder") and I'm not sure about the benefit. Plus it makes it so you can't just run dprint fmt
in the project's directory and things "just work", so I think I'd rather discourage it. Most tools require their configs in the root folder.
I have a similar and yet somewhat different need: I use a .jsonc
file for my config (so I can put comments).
The CLI is happy with it as long as I point to it via the --config
option.
The VSCode extension however does not automatically look for that file extension, and that's why I was also looking for an option to set the path (but really the name) of the configuration file.
Is that something that might happen in the future -- that or adding dprint.jsonc
to the list of possible config files?
@spiffre I opened https://github.com/dprint/dprint-vscode/pull/59 to auto-discover .jsonc
config files.
Many thanks @dsherret!
dprint
supports a--config
CLI parameter allowing for a custom configuration path to be specified. However, the VSCode plugin expects.dprint.json
to be in the root of the workspace. It would be great if a configuration property could be added to the plugin, for example,"dprint.configurationFile": "path/to/my/dprint.json"
.