Giter Site home page Giter Site logo

vscode-phpstan's People

Contributors

breeze2 avatar dependabot[bot] avatar johnstoncode avatar mtorromeo avatar vaggal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-phpstan's Issues

Debug hang when using this extension

VSCode version : 1.46.1
PHP version: 7.3.13
XDebug version: v2.7.0
OS: MacOS 10.15.5

When I run debug at a breakpoint (with xdebug), VSCode debug panel hang. It might show the variables, but expanding a variable doesn't work. The spinner will stay there indefinitely. See screenshot below :
85951122-1da25200-b92f-11ea-8c79-50b4e623fa20

When this happens, I can't "stop" execution of the "run", and get this timeout notification. Whole php might hang after (can't run script at all) :
85951125-2004ac00-b92f-11ea-8251-2ec3e481267e

I tested with different projects, with local xdebug / php installed on the host machine and in a Vagrant box, plus . It used to work a couple of weeks ago.

So far, I've isolated the issue with this extension. When I disable it, everything is fine.

(ref.: xdebug/vscode-php-debug#412)

Extension crashes VSCode extension host

Issue Type: Bug

If extension is enabled - extension host crashes immediately.

Extension version: 1.1.5
VS Code version: Code 1.66.0 (e18005f0f1b33c29e81d732535d8c0e47cafb0b5, 2022-03-30T05:49:37.118Z)
OS version: Darwin arm64 21.4.0
Restricted Mode: No

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 4, 3
Memory (System) 32.00GB (1.51GB free)
Process Argv --crash-reporter-id 9ddfdd4f-7828-47e7-89df-2b84a7e0238e
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
cppdebugcf:30465022
pynewfile477:30463512

Dev Tools log messages

/Applications/Visual Studio Code.app/Contents/MacOS/Electron[20846]: ../../third_party/electron_node/src/spawn_sync.cc:523:Maybe node::SyncProcessRunner::TryInitializeAndRunLoop(Localv8::Value): Assertion `(exit_status_) >= (0)' failed. 1: 0x10cee68a0 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 2: 0x10cee669c node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 3: 0x10cf9a3f0 node::PromiseRejectCallback(v8::PromiseRejectMessage) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 4: 0x10cf9a098 node::PromiseRejectCallback(v8::PromiseRejectMessage) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 5: 0x10cf9a020 node::PromiseRejectCallback(v8::PromiseRejectMessage) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 6: 0x108c6c870 v8::internal::Accessors::MakeAccessor(v8::internal::Isolate*, v8::internal::Handlev8::internal::Name, void ()(v8::Localv8::Name, v8::PropertyCallbackInfov8::Value const&), void ()(v8::Localv8::Name, v8::Localv8::Value, v8::PropertyCallbackInfov8::Boolean const&)) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework] 7: 0x7407f0a1ac 8: 0x7407e8d758 9: 0x7407e8d758 10: 0x7407e8d758 11: 0x7407e8d758 12: 0x7407e8d758 13: 0x7407e8d758 14: 0x7407e8d758 15: 0x7407e8d758 16: 0x7407e8d758 17: 0x740021d638 18: 0x74000fa82c 19: 0x7407e8b42c 20: 0x7407e8b0c8 21: 0x108d27294 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, int, v8::internal::Handlev8::internal::Object) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]22: 0x108c1a7b0 v8::Function::Call(v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]23: 0x10ce873c8 node::EmitAsyncDestroy(node::Environment*, node::async_context) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]24: 0x107878a8c uv_timer_get_due_in [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]25: 0x10787b738 uv_run [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]26: 0x107a17054 v8::CodeEvent::GetScriptName() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]27: 0x10788c8cc ElectronInitializeICUandStartNode [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]28: 0x1005f5088

abstractExtensionService.ts:887 Extension host (LocalProcess) terminated unexpectedly. Code: null, Signal: SIGABRT
_onExtensionHostCrashed @ abstractExtensionService.ts:887

log.ts:313 ERR Extension host (LocalProcess) terminated unexpectedly. No extensions were activated.
notificationsAlerts.ts:42 Extension host terminated unexpectedly 3 times within the last 5 minutes.

Error when attempting to lint file

When attempting to lint a file (via command pallate and automatically) an error occurs.

[2020-08-25 08:58:51.954] [exthost] [error] TypeError: Cannot read property 'analyseFile' of undefined
	at _shouldAnalyseFile (/home/silicon/.vscode-server/extensions/breezelin.phpstan-1.1.3/out/controller.js:61:18)
	at _executeContributedCommand (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:666:374)
	at _.$executeContributedCommand (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:666:749)
	at m._doInvokeHandler (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:843:926)
	at m._invokeHandler (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:843:618)
	at m._receiveRequest (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:842:252)
	at m._receiveOneMessage (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:841:6)
	at /home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:839:161
	at l.fire (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:46:222)
	at v.fire (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:239:494)
	at /home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:1031:179
	at l.fire (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:46:222)
	at v.fire (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:239:494)
	at t.PersistentProtocol._receiveMessage (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:244:17)
	at /home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:241:67
	at l.fire (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:46:222)
	at p.acceptChunk (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:236:949)
	at /home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:236:301
	at Socket.t (/home/silicon/.vscode-server/bin/3dd905126b34dcd4de81fa624eb3a8cbe7485f13/out/vs/server/remoteExtensionHostProcess.js:245:572)
	at Socket.emit (events.js:200:13)
	at addChunk (_stream_readable.js:294:12)
	at readableAddChunk (_stream_readable.js:275:11)
	at Socket.Readable.push (_stream_readable.js:210:10)
	at TCP.onStreamRead (internal/stream_base_commons.js:166:17) extension.phpstanLintThisFile

VS Code Info
Version: 1.48.1 (system setup)
Commit: 3dd905126b34dcd4de81fa624eb3a8cbe7485f13
Date: 2020-08-19T17:12:13.244Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

PHP Info
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Does not work with latest phpstan versions

Hi,
I'm using phpstan 0.12.84, and I can't get the extension to work.
I guess that's because of some recently added phpstan settings. I get this error in vscode devtools:

[Extension Host] [phpstan] failed: Invalid configuration:Unexpected option 'parameters › excludePaths'.

Here is my phpstan.neon :

parameters:
  level: 5
  paths:
    - .
  excludePaths:
    analyse:
      - vendor
      - tests
    analyseAndScan:
      - web/wp/wp-admin/includes/noop.php

Doesn't run in Windows; no debug information

After installing phpstan with:
composer global require phpstan/phpstan

I open a file, select the available F1 option "PhpStan: Lint this file" Right hand side of status bar says "[phpstan] failed" No information in any debug window. Running phpstan from the command line works.

phpstan -V
PHPStan - PHP Static Analysis Tool 0.12.64

I'm not sure where to turn to debug this.

No settings in VS Code for phpstan.* settings

Thank you for your work!

your quote:

This extension contributes the following settings:

phpstan.level: rule levels 0-7, default max
phpstan.noProgress: no progress output, default true
phpstan.memoryLimit: memory limit, default 512M
phpstan.configuration: path of configuration
phpstan.autoloadFile: path of autoload file

But in VS code there are no settings/properties for your Extention (@ext:breezelin.phpstan).
What did you mean? How to set these properties?

thanks!

Extension does not return results after updating to phpstan 1.9.16 when xDebug is used

Hi,

after updating phpstan 1.9.16 through composer the extension does no longer fetch problems in vscode and errors out with this message:

2023-02-08 14:27:26.131 [error] [Extension Host] [phpstan] failed: 
 ! [NOTE] The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process
 !        will not halt at breakpoints.

My quick and dirty fix is to hack the extensions controller.js to push --xdebug as command line parameter to phpstan like this:

makeCommandArgs(args) {
    let result = [];
    result.push("analyse");
    result.push("--xdebug");
    result.push("--error-format=json");
    if (args.level === "config") {
        // set level in config file
    }
    else if (args.level) {
        result.push("--level=" + args.level);
    }
    else {
        result.push("--level=max");
    }
    if (args.noProgress) {
        result.push("--no-progress");
    }
    if (args.memoryLimit) {
        result.push("--memory-limit=" + args.memoryLimit);
    }
    if (args.configuration) {
        result.push("--configuration=" + args.configuration);
    }
    if (args.autoloadFile) {
        result.push("--autoload-file=" + args.autoloadFile);
    }
    if (args.path) {
        result.push(args.path);
    }
    return result;
}

File is analysed multiple times

Hello,
I have noticed that the analysis of a php file happens multiple times when you open it for the first time or make changes to it.

After some checking it seems that the double checking is triggered by the double fire of the onDidOpenTextDocument event. It seems that it is up to the extension to handle it properly.
The issue onDidOpenTextDocument event is missing event information contains some workarounds for this.

Getting level from configuration file

Hello. Thanks for this extension, it is very useful for me.
I'm working on several projects in which different levels for phpstan is used. Level and any other settings I always set in configuration file. But this extension always overrides configuration level by passing its own level value from extension settings as an argument to phpstan:

if (args.level) {
result.push("--level=" + args.level);
} else {
result.push("--level=max");
}

Because of this, when I need to change level, I'm forced to do it in 2 places (configuration file and extension settings). It would be nice to have suppress of sending level argument (for example, by entering empty string to level field in extension settings, or by additional checkbox).

Unexpected end of JSON input

I'm having problems using this extension. At first,it didn't seem to do anything. I checked the logs and found the following error

[2019-02-15 12:52:22.726] [renderer1] [error] Unexpected end of JSON input: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>:null:null)
    at ChildProcess.analyse.phpstan.on.code (C:\Users\XXXXXXX\.vscode\extensions\breezelin.phpstan-1.0.6\out\controller.js:184:29)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)

I can successfully run the following command from the project root, so I assume PHPstan is functioning:

phpstan analyse app --level 3

OS: Win10
PHP Static Analysis: 1.0.6
VS: 1.31.1

php not found

This is what it tells me.

[phpstan] stderr: 'php' is not recognized as an internal or external command,
operable program or batch file.
[phpstan] exit: 1

Isn't there a configuration option for that, like:
"php.validate.executablePath": "c:/Development/Laragon_lite/bin/php/php-7.2.10-nts-Win32-VC15-x64/php.exe",

Support locally installed phpstan

Currently, the extension only seems to work with phpstan installed globally, please support installed locally too. This could be as simple as allowing to specify the path to the phpstan executable

Vulnerable dependency: https-proxy-agent

`13:13 $ npm audit

                   === npm audit security report ===

Run npm update https-proxy-agent --depth 3 to resolve 1 vulnerability

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Machine-In-The-Middle │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ https-proxy-agent │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ vscode [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ vscode > vscode-test > https-proxy-agent │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1184
└───────────────┴──────────────────────────────────────────────────────────────┘

found 1 high severity vulnerability in 184 scanned packages
run npm audit fix to fix 1 of them.`

'rules.45' not found

Ok, this is what I get now.

[phpstan] stderr: Note: Using configuration file c:\Data\git\AllWidgetSwoole\phpstan.neon.

In ContainerBuilder.php line 550:

Class PHPStan\Rules\PHPUnit\AssertSameBooleanExpectedRule used in service 'rules.45' not found.

analyse [-c|--configuration CONFIGURATION] [-l|--level LEVEL] [--no-progress] [--debug] [-a|--autoload-file AUTOLOAD-FILE] [--error-format ERROR-FORMAT] [--errorFormat ERRORFORMAT] [--memory-limit MEMORY-LIMIT] [--] [...]

[phpstan] exit: 0

Please add path ignore pattern support.

When I'm looking at third party code, those files are analyzed and my problems tab quickly gets filled with errors in code that is outside of my control, which is useless for me and which makes it more difficult to find any relevant problems among the clutter.

Errors disappear during analysis

During the analysis, all existing errors disappear for a brief moment before reappearing.
Is this behaviour desirable? Similar linting extensions for ts and js files just update the errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.