psalm / psalm-vscode-plugin

VS Code plugin for Psalm
MIT License
44 stars 14 forks source link

Very slow on large files #251

Closed M393 closed 1 year ago

M393 commented 1 year ago

When editing a large file with a few thousand lines the plugin is very slow. It can take multiple minutes until the the errors for the current document state are shown. During this lots of messages as below are logged:

[Error - 4:54:36 PM] Method $/cancelRequest is not implemented [Error - 4:54:36 PM] Method $/cancelRequest is not implemented [Error - 4:54:40 PM] Method $/cancelRequest is not implemented [Error - 4:54:40 PM] Method $/cancelRequest is not implemented [Error - 4:54:44 PM] Method $/cancelRequest is not implemented [Error - 4:54:44 PM] Method $/cancelRequest is not implemented [Error - 4:54:44 PM] Method $/cancelRequest is not implemented [Error - 4:54:44 PM] Method $/cancelRequest is not implemented [Error - 4:54:44 PM] Method $/cancelRequest is not implemented [Error - 4:54:45 PM] Method $/cancelRequest is not implemented [Error - 4:54:45 PM] Method $/cancelRequest is not implemented [Error - 4:54:45 PM] Method $/cancelRequest is not implemented [...]

So I assume the plugin queues every change of the document to be sent to the psalm language server, without ever skipping outdated states.

Would be great if this could be improved. This plugin is very helpful otherwise, thanks.

tm1000 commented 1 year ago

It's more so that every change is processed and there is no way to cancel previous changes because php's non-async nature. So Psalm processes every change you make in full

You can try messing with the setting: --on-change-debounce-ms=

In my company we use:

    "psalm.psalmScriptArgs": [
        "--on-change-debounce-ms=500"
    ]

This means that if theres no activity for 500ms then process the changes

M393 commented 1 year ago

Thanks for this, it is much better.