SanderRonde / phpstan-vscode

PHPStan plugin for VSCode
https://marketplace.visualstudio.com/items?itemName=SanderRonde.phpstan-vscode
MIT License
43 stars 8 forks source link

[Bug] Language server crashes on Linux #60

Closed Domi04151309 closed 7 months ago

Domi04151309 commented 7 months ago

Description

The phpstan language server crashes when a custom bin is set on Linux.

image

Pasting the path into the terminal works without issues.

image

Versions

Operating System

Linux Mint 21.3 Cinnamon

VSCode

Version: 1.87.0 Commit: 019f4d1419fbc8219a181fab7892ebccf7ee29a2 Date: 2024-02-27T23:42:16.599Z Electron: 27.3.2 ElectronBuildId: 26836302 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Linux x64 5.15.0-97-generic

PHPStan Extension

v2.2.26

Settings

{
    ...
    "phpstan.binCommand": [
        "~/.config/composer/vendor/bin/phpstan"
    ],
    ...
}

Output

Node.js v18.17.1
[Info  - 4:34:07 PM] Connection to server got closed. Server will restart.
[server] Language server ready
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: spawn ~/.config/composer/vendor/bin/phpstan ENOENT
    at Process.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ~/.config/composer/vendor/bin/phpstan',
  path: '~/.config/composer/vendor/bin/phpstan',
  spawnargs: [ '--version' ]
}

Node.js v18.17.1
[Error - 4:34:07 PM] The PHPStan Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
SanderRonde commented 7 months ago

Ahh could it be that it's not expanding the homedir? What happens if you put in the full path? If that does work then I'll make sure it expands the homedir

Domi04151309 commented 7 months ago

It works with the full path 👍🏼 Thanks for the quick response.

SanderRonde commented 7 months ago

Fix should be live in the pre-release version (or using the full expanded path is fine as well :))