Closed Balkoth closed 2 years ago
Hmm weird that it's going for that temporary director. Can you do a few things for me?
C:/Temp
actually existsnode -e "console.log(require('os').tmpdir())"
in a terminal for me and tell me what it outputs? This should print your temp dir (which should be C:/Temp
probablyThe folder C:\Temp
is actually existing.
Windows Version 2004 19041.1415
The command points to: ❯ node -e "console.log(require('os').tmpdir())" C:\Users\{user}\AppData\Local\Temp
Ah I completely misunderstood the issue. I thought something was going wrong with the extension creating a temporary file but it was actually just you using it on a workspace located at C:/Temp
. I think I know what the issue is and I've fixed it in version 1.2.0 (which I just published). Can you let me know if that fixed it?
Will check and get back to you next week.
Now it does not error out, but does not show problems either.
When you open the output
panel for PHPStan
, what is logged there? Does the errors=
log contain any errors or does it not log any either?
There is nothing after errors=
in a file which has problems shown when used with PHP Static Analysis
and the same configuration file.
Just checking but can you run the PHPStan binary with the args that are posted in the logs? Does PHPStan output any errors then?
Test file:
<?php
function test($param)
{
if (!$result)
return 'ERROR';
return 'OK';
}
?>
phpstan-vscode:
Document saved, checking
Checking file c:\Temp\PHPStan-vsc\functions.php
Showing status bar
Spawning PHPStan with the following configuration: {"binPath":"C:\\Program Files\\Composer\\vendor\\bin","args":["analyse","-c","C:\\Temp\\PHPStan-vsc\\phpstan.neon","--error-format=raw","--no-progress","--no-interaction","--memory-limit=1G","c:\\Temp\\PHPStan-vsc\\functions.php"],"cwd":"c:\\Temp\\PHPStan-vsc"}
PHPStan process exited succesfully
Hiding status bar, last operation result = Success
File check done for file c:\Temp\PHPStan-vsc\functions.php errors=
Active editor changed, checking
Running PHPStan binary from cmd:
"C:\Program Files\Composer\vendor\bin\phpstan.bat" analyse -c "C:\Temp\PHPStan-vsc\phpstan.neon" --error-format=raw --no-progress --no-interaction --memory-limit=1G "C:\Temp\PHPStan-vsc\functions.php"
C:\Temp\PHPStan-vsc\functions.php:3:Function test() has no return type specified.
C:\Temp\PHPStan-vsc\functions.php:3:Function test() has parameter $param with no type specified.
C:\Temp\PHPStan-vsc\functions.php:5:Undefined variable: $result
Thanks for the info! Looks like the binPath
setting is not correct. It's currently pointing to the binary folder, not the actual binary to run. Can you check if it works when you change it to be the full C:\Program Files\Composer\vendor\bin\phpstan.bat
(or C:\Program Files\Composer\vendor\bin\phpstan
, not sure what's right on Windows)?
Does not matter:
Document saved, checking
Checking file c:\Temp\PHPStan-vsc\functions.php
Showing status bar
Spawning PHPStan with the following configuration: {"binPath":"C:\\Program Files\\Composer\\vendor\\bin\\phpstan.bat","args":["analyse","-c","C:\\Work\\Config\\phpstan.neon","--error-format=raw","--no-progress","--no-interaction","--memory-limit=1G","c:\\Temp\\PHPStan-vsc\\functions.php"],"cwd":"c:\\Temp\\PHPStan-vsc"}
PHPStan process exited succesfully
Hiding status bar, last operation result = Success
File check done for file c:\Temp\PHPStan-vsc\functions.php errors=
Document saved, checking
Checking file c:\Temp\PHPStan-vsc\functions.php
Showing status bar
Spawning PHPStan with the following configuration: {"binPath":"C:\\Program Files\\Composer\\vendor\\bin\\phpstan","args":["analyse","-c","C:\\Work\\Config\\phpstan.neon","--error-format=raw","--no-progress","--no-interaction","--memory-limit=1G","c:\\Temp\\PHPStan-vsc\\functions.php"],"cwd":"c:\\Temp\\PHPStan-vsc"}
PHPStan process exited succesfully
Hiding status bar, last operation result = Success
File check done for file c:\Temp\PHPStan-vsc\functions.php errors=
Hmm I'm getting no issues when trying out that configuration (as far as I can replicate it). Can you send me these things:
As requested: PHPStan-vsc.zip
"phpstan.binPath": "C:\\Program Files\\Composer\\vendor\\bin\\phpstan.bat",
"phpstan.configFile": "C:\\Temp\\PHPStan-vsc\\phpstan.neon"
I tried your exact setup but it worked fine for me so I'm really not sure what's going on here. Can you try installing this version of the extension and showing me the new logs? It's got some more logging in it. Simply rename it from .zip
to .vsix
and drag it into your extensions pane (github doesn't allow uploading of .vsix
files).
phpstan-vscode-1.2.1.zip
Yes, this version helped identifying the issue:
Document saved, checking
Checking file c:\Temp\PHPStan-vsc\functions.php
Showing status bar
Spawning PHPStan with the following configuration: {"binPath":"C:\\Program Files\\Composer\\vendor\\bin\\phpstan.bat","args":["analyse","-c","C:\\Temp\\PHPStan-vsc\\phpstan.neon","--error-format=raw","--no-progress","--no-interaction","--memory-limit=1G","c:\\Temp\\PHPStan-vsc\\functions.php"],"cwd":"c:\\Temp\\PHPStan-vsc"}
Got data Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
All data received= Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
PHPStan process exited succesfully
Hiding status bar, last operation result = Success
File check done for file c:\Temp\PHPStan-vsc\functions.php errors=
Got data Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
So there is an issue when binPath
contains spaces. If i change this to a path with no spaces it works!
Ah classic error. Will fix it in a bit
This is the phpstan-vscode output:
Running PHPStan manually from the command line works fine.