nova-prettier
nova-prettier copied to clipboard
Infer tab width based on the current document tab configuration?
I think it would be nice if the extension could configure Prettier dynamically based on the current document tab width (the thing in the bottom right corner of the editor) :

It would be easier when working with projects mixing e.g. 2-spaces and 4-spaces wide tabs. Currently the only solution that I know of is changing the width manually in the extension preferences before saving each file ?
Hm! It seems to respect .editorconfig
, though; I use that to set the tab width in Nova, and, implicitly, the same happens to the plugin as well. I've tested now on two different projects, each having different tab settings on .editorconfig
— Prettier most certainly uses them!
@GwynethLlewelyn sure, but let's say I have a project where the main language is unrelated (unsupported) by Prettier, and am still using a few .yml files here and there for configuration. It seems overkill to have an .editorconfig
file in the project just for these few files.
Plus, if I'm not mistaken Prettier does not support a global configuration, so I can't go that way either.
I'd argue that in cases where there is no .editorconfig
found for the file being reformatted, defaulting to the current document tab width set by Nova is reasonable.
Aye, I totally get your point, it's definitely the most reasonable approach....
This sounds kind of nice to have, but there's two things I'm not quite sure about:
- There's defaults in the extension and/or project settings — it seems strange to override these and / or only have indentation settings defined differently.
- People might actually want to change/fix the indentation to their standard?
Maybe this should be an option though — not setting default indentation?
So this would be great, but even basic settings would be better. As far as I can tell, neither the Nova global settings (in the extension manager) or project settings work for adjusting the indentation size. No matter what I do, upon save it adjusts things to the default of 2 spaces. Seems this should work without an .editorconfig
right? Or am I doing something wrong?