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

Add a --stdin-path argument #1530

Closed
natebosch opened this issue Aug 16, 2024 · 2 comments · Fixed by #1566
Closed

Add a --stdin-path argument #1530

natebosch opened this issue Aug 16, 2024 · 2 comments · Fixed by #1566

Comments

@natebosch
Copy link
Member

natebosch commented Aug 16, 2024

The vim plugin formats using stdin so that we can format without writing the buffer. We added --stdin-name argument so that error messages can include the file name and makes it easier for us to associate the errors back to the buffer. Now that formatting depends on language version can we add a --stdin-path argument to ask the formatter to treat the content as if it had been written to that location, and find the language version accordingly.

#1402 (comment)

@munificent
Copy link
Member

I've been thinking about it more and maybe it makes more sense to just use the existing --stdin-name option as the path and search for a package config surrounding that. If you don't want it to search, you can always disable that by passing in an explicit language version or --language-version=latest. What do you think?

@natebosch
Copy link
Member Author

That behavior SGTM. That should make the vim plugin just keep working without change.

munificent added a commit that referenced this issue Sep 13, 2024
If --stdin-name is given, then look for a surrounding package config to
infer the default language version from for code read from stdin. To
avoid that behavior, you can pass in a language version explicitly
using --language-version.

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

Successfully merging a pull request may close this issue.

2 participants