psalm / psalm-vscode-plugin

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

Multiple psalm script paths #288

Closed kyteinsky closed 5 months ago

kyteinsky commented 5 months ago

Hello! Thank you for the excellent extension. I felt a need for specifying multiple paths for psalm script working on different projects with different composer setups. Not sure if other people find themselves needing this.
In any case, here is my unrefined code. Please let me know if you'd like me to open a PR. Even better if you decide to do a cleaner implementation.

tm1000 commented 5 months ago

You don't need to change this setting to an array if you use vscode workspace configurations. Unless I'm misunderstanding what you are doing but I know of no other extensions in the marketplace that allow their LSPs to be listed as arrays. People just use workspace configurations.

kyteinsky commented 5 months ago

Yeah I can see people using that when they have 2-3 related projects/folders. It gets messy for my special use case where I need to mix and match different projects. Also, psalm would then try to scan all the attached projects in the workspace, one of them being a behemoth of a project. Caching does not help since there is an occasional need to clear the cache for psalm to behave in an expected manner.

Also, yeah it is true no other LSP extension uses an array for the path but honestly I don't see any harm in doing so since all paths are checked and the list acts as a preference order.

I'll publish my fork for anyone who has a similar use case and close this issue. Thank you.

tm1000 commented 5 months ago

The harm in doing so is changing a previous string to an array

I have projects that have multiple configurations on vscode. You just need to use vscode workspaces and workspace folders and workspace settings

kyteinsky commented 5 months ago

Ah I didn't consider the backward compatibility, silly sleep deprived me.

Now that you phrase it that way, it just hit me that workspaces don't need to always contain multiple folders (the way I used it until now), every project could have its own config.

Thanks Andrew, that was eye-opening, going to update my bash scripts asap haha!

tm1000 commented 5 months ago

@kyteinsky sorry if I sounded abrasive at all in the conversation and glad I was able to help!

kyteinsky commented 5 months ago

Not at all! I think I gave you the wrong idea by closing the issue too quickly. You were super helpful and welcoming to the contrary :D