Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format of generated config file conflicts with what deno fmt prefers #498

Closed
magurotuna opened this issue Aug 21, 2021 · 8 comments
Closed

Comments

@magurotuna
Copy link
Member

On initializing, the plugin generates a config JSON file with 4-space indent, but it conflicts with deno fmt since it prefers 2-space indent. It is a kind of annoying that running deno fmt formats .vscode/settings.json just after it's generated.
It would be better if we could make the plugin generate a JSON file whose format deno fmt likes.

However, from my quick browse, unfortunately it seems like the VSCode Extension API doesn't provide a way of configuring the indent size of config files. https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration

@kitsonk
Copy link
Contributor

kitsonk commented Aug 21, 2021

Correct, I don't think there is anything we can do about it, we don't actually write a file, we simply access APIs that persist the data as vscode sees fit.

So I am going to close this as a design limitation.

@kitsonk kitsonk closed this as completed Aug 21, 2021
@ry
Copy link
Member

ry commented Aug 21, 2021

Could we hardcode into deno fmt to not format .vscode/settings.json ?

@kitsonk
Copy link
Contributor

kitsonk commented Aug 21, 2021

I suspect some people would want to deno fmt the file, right?

@ry
Copy link
Member

ry commented Aug 21, 2021

Maybe we'd allow it if someone does deno fmt .vscode/settings.json but a normal deno fmt call could ignore the .vscode directory by default.

@kitsonk
Copy link
Contributor

kitsonk commented Aug 21, 2021

Opened a suggestion in deno_lint.

@ry
Copy link
Member

ry commented Aug 21, 2021

Why in deno_lint? Shouldn't it be in deno/cli/tools/fmt.rs ?

@caspervonb
Copy link

caspervonb commented Aug 21, 2021

Why in deno_lint? Shouldn't it be in deno/cli/tools/fmt.rs ?

The predicate we use is in deno/cli/fs_util.rs.
Just expand on that with a new predicate, something like is_supported_fmt_path one (test uses that same naming, ext and path).

Maybe we should just filter dotfiles in general rather than start maintaining a potentially ever growing list special cases?

@kitsonk
Copy link
Contributor

kitsonk commented Aug 21, 2021

Moved the issue to deno then. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants