-
Notifications
You must be signed in to change notification settings - Fork 12
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
Stop adding newline to end of file #138
Comments
Can I ask what your output looks like when you run phpcs in the terminal against your file?
|
Yes, it just states: "No fixable errors were found" if I ensure to have the file saved without a newline at the end and no other errors. If I add other errors, it will list and fix them, but not add the newline. So I am a bit stumped as to where it comes from when formatting through the extension and how to log that. 😅 |
Yeah, it is weird, because I don't see anything adding a newline in the extension code either. I've never noticed this because I don't exclude the PSR2.Files.EndFileNewline.NoneFound rule, but I am able to replicate the issue using your phpcs.xml file, so I will keep digging. |
@Dekadinious I found the problem, and opened a PR to fix it in #142 Are you able to test the PR to confirm it resolves the issue? |
@jonathanbossenger That's great, and I would love that. But how do I test a specific PR? 😅 |
@Dekadinious, essentially you use the same steps to run the development version listed here
This will open a new VS code instance running the code from that branch, which you can use to test. |
@jonathanbossenger Thank you for the guidance! I can confirm that it works, and I also tested #139 and can confirm that both spaces and special characters no longer trigger the error :) |
I came from the wongjn extension recently, and I can't seem to get this extension to stop adding a new line at the end of my files.
I have turned "Files: Insert Final Newline" in VSCode off. I also have this in my ruleset:
When running phpcbf manually, no newlines are added and no fixes are available on the file. When I save the file and the formatter runs, a newline is added. If I disable phpcbf from this extension, no newline is added. If I run the exact phpcbf command this extension runs, no fixes are available and no newlines are added.
The only time a newline is added is if I save the file or run formatting on it, or run F1 -> PHPCBF: Fix this file.
How can I make it stop?
The text was updated successfully, but these errors were encountered: