Closed thijsw closed 8 years ago
I am seeing the same problem on Windows, though curiously not on my Mac -- same file being linted. This happens when I'm linting a small controller class file. No other files are open in the Explorer tab of VS Code. Linting is fast from the command prompt.
VS Code: Version 1.0.0 Commit fa6d0f03813dfb9df4589c30121e9fcffa8a8ec8 Date 2016-04-13T14:08:36.599Z Shell 0.35.6 Renderer 45.0.2454.85 Node 4.1.1
PHPCS: PHP_CodeSniffer version 2.6.0 (stable) by Squiz (http://www.squiz.net)
phpcs extension: 0.4.0
OS: Windows 10 Pro (64-bit)
Hello and thank you for your feedback.
I have just released 0.5.0 which has updated dependencies for vscode 1.0.0 Please update to this version and let me know whether this fixes the issues you are experiencing.
@thijsw Does the file have a lot of linting errors?
I encapsulated the problem. The child_process, which actually does the linting, triggers the stdout, stderr and close stuff, but it takes far too long. I will investigate further!
@temkretz I am at the same point and tested both spawn and exec but the slowdown is massive...
@ikappas Yes. My observation: The phpcs process created through spawn() is waiting in "SLEEP" state as seen in "ps". Dunno why, will investigate further :)
On my system it gets a nice value of "31" which is very high..
@temkretz I can also confirm that phpcs 2.6.0 is way too slower than phpcs 2.4.0
Yeah, but if I run the command from commandline it instant finishes.
True
What confuses me is, that I forked the vscode-language-server-example project from MS, do a cp.exec(phpcs....) and it instantly runs oO
Maybe I missed something when I ported from that source code ...
I will try to do this with the --format=json as well!
there is a bug with --format=json reported https://github.com/squizlabs/PHP_CodeSniffer/issues/969
Let me push some changes on develop and work on those... How does that sound?
@temkretz I just pushed some changes on develop. Can you please do your testing against that source code?
@ikappas Alright, just checked it out ;)
I don't think that phpcs is the problem, the process just doesn't get executed instantly.
On develop I switched to child_process exec instead of spawn but this does not seem to affect the problem in any way
Nope it doesn't :( For what reason ever the spawned process waits to be executed. I will try something.
@temkretz I just pushed some changes to develop and I think I nailed it. Let me know if this works for you.
@ikappas Work wonderful! Damn processes >.>
I think you can merge it into master :)
@temkretz That is good to hear! Thank you for your assistance
No problem 👍
@ikappas merge? :P
Fixing Windows issue and will merge ;)
I just published phpcs 0.6.0 which should take care of this issue. Please let me know if this works!
@ikappas works fantastic. thx!
Good to hear, closing this issue.
First of all, thanks for this extension! It is very helpful :)
Unfortunately, I encounter very slow linting performance in my project. It is a very straightforward project with just a bunch of classes, some Composer dependencies, and that's it.
Linting a single file in Visual Studio Code takes about a whole minute ("phpcs is linting 1 document ... /"), whereas if I run the sniffer from the command line, it takes around 25-50ms for every file.
Any idea how this is possible?
System: OSX 10.11.4 / 8GB RAM / 4GHz i7