-
Notifications
You must be signed in to change notification settings - Fork 19
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
Sublime formatting won't work if file is not saved #30
Comments
Not exactly the same issue but probably the same cause. It seems it's not running against the current altered version of the file. |
The formatter doesn't run on the buffer, it runs on the underlying file. If you save the file and then run the command to format it, it will format the underlying file which will update the buffer. You should then be able to format without |
We understood that so far. But that's not what people expect. If we run the command, we expect it to run against the buffer, state of the code that we are seeing. If for some reason it is not possible, I don't know sublime API, then it would help to mention it in the docs. No? |
I believe it would be possible by having a command that takes the buffer, writes it to a tmp file in the current directory, runs eslint on it, and copies the file contents back to the buffer and cleans up the temp. Happy to accept a PR adding that functionality or updating the docs explaining how it currently works. |
) * docs(readme): add note about current behaviour, need to save first. See Github issue #30 * Wording
I believe this is typically handled by sending the contents of the buffer to the 'executable' via stdin. |
So some investigating revealed that eslint won't run the
results in a json file on stdout.
There is a spot in the eslint engine file where it grabs the current working directory. There may be a need to file a pull request/issue to get that cwd exposed as a command line option, that way all the proper config files and things would be pulled relative to |
Getting this working would also allow for the formatting of inline |
Wow, thanks for digging into this! It sounds like there might be some work on the ESLint side to support this functionality. @s7726, I've also gone ahead and made you a collaborator on this project. The investigation you did makes me trust you. :P Feel empowered to modify and add the functionality to this plugin you find necessary. |
Just noticed eslint_d has a @TheSavior Thanks for the Maintainorship. I'm still looking into this on the side of the project that prompted the issue. |
just spent over an hour figuring out why this bloody file wouldn't get formatted .. (after even more hours trying to resolve node path issues..) I haven't read the entire issue, but my 2 cents on the matter are: |
Minor bug, not that important but still an issue: formatting doesn't work (no errors, just doesn't do anything) if the file is not saved first.
The text was updated successfully, but these errors were encountered: