Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

files outside of root directory ? #2986

Open
MarcWeber opened this issue Jan 26, 2024 · 3 comments
Open

files outside of root directory ? #2986

MarcWeber opened this issue Jan 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@MarcWeber
Copy link

Language server

psalm and files outside of root_dir

Requested feature

Psalm allows to set directories in psaml.xml with
Now if you open PHP files you don't get errors because it's outside of the root directory.

So what I suggest is that a LSP language server can somehow overwrite what files it wants to attach to ?
Eg a psalm implementation could actually read the src attributes.

So finding out about what language server supports a file it would be like: If there is any up and running ask it if it serves the file, otherwise find new root and start a second one.

There are multi directory workspaces proposals maybe more I didn't look into.

Maybe there is a simple solution I missed.
I tried symlinking the directory and that failed cause LSP follows the real path before finding root.

Other clients which have this feature

No response

@MarcWeber MarcWeber added the enhancement New feature or request label Jan 26, 2024
@justinmk
Copy link
Member

Are you looking for "single file support"?

SINGLE FILE SUPPORT *lspconfig-single-file-support*

see also:
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md

@justinmk justinmk changed the title files outside of root diretory ? files outside of root directory ? Jan 26, 2024
@MarcWeber
Copy link
Author

Single files means a new language server gets started for each file which is in case of PSALM huge overhead because parsing and analyzing all the files (60K LOC) takes like 15 seconds. So while it actually got activated the issue is configuration because the >>library<< doesn't know the project using it. I could work around by adding a psalm.xml config file and choosing one of the many. But doesn't feel like a true fix. Actually using git submodule or such would be good enough for development. But having to checkout code 40 times cause there are 40+ projects using it feels more hackish.

@npbreland
Copy link

I'm not sure if this is the same issue I have, but it sounds like it. It would be great to be able to define, in the LSP setup, directories outside of the project root. This would be useful when writing tests (e.g. PHPUnit) or other files written with an API whose source code you don't have installed in your project root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants