-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Infer via shebang #5149
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
Infer via shebang #5149
Conversation
…volves opening and reading (the first line) of the file just to detect the type, (a) do this check last and (b) cache it lazily.
…file does have an extension.
…ily, extract just the interpreter executable name from shebangs, rather than comparing shebangs as a whole.
Just information: we have same request in |
…committed PHP test. Add unknown-shebang test.
@ikatyang I’m not a very experienced contributor in general, let alone here: I see I have a failing codecov check, but I’m not sure if it’s significant. Should I do anything else to have this merged? |
You could add some I generally wait for one day or two after I approved it to see if there's any comment from other maintainers, I'll merge it then if there's no objection. |
Thanks! |
Awesome! Will this work with |
Not the way I wrote it in this PR—I’ve never seen that kind of shebang, so I didn’t know to look for it. But it should be trivial to add that. |
Was this ever released? Both this PR and the issue it fixes were never mentioned in the changelog. |
@aleclarson I’m pleased to say it was merged and released; indeed I can’t see it in the changelog, but it’s mentioned in the blog: https://prettier.io/blog/2018/11/07/1.15.0.html#api-cli And our build scripts are much Prettier. |
Fixes #5122
If no file type can be inferred, this attempts to read the first line of a file and extract a shebang, which can be checked against a known list.
I’ve documented the changes I’ve made (in theThere doesn’t seem to be any documentation on type inference to update.docs/
directory)