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

LSP-tailwindcss starts in an unrelated PHP project. #39

Open
UltraInstinct05 opened this issue May 8, 2022 · 7 comments
Open

LSP-tailwindcss starts in an unrelated PHP project. #39

UltraInstinct05 opened this issue May 8, 2022 · 7 comments

Comments

@UltraInstinct05
Copy link

I just have a simple PHP folder with no tailwind.config.js and yet the tailwind css server seems to spin up. I guess if there is nothing related to tailwind in the folder, don't start the server ?

image

@rchl
Copy link
Member

rchl commented Jun 17, 2022

Introducing logic to detect whether it's possibly a tailwind project or not would not be great from the standpoint of maintainability. Something like that was implemented here before but was eventually removed (#35).

I would suggest that you just override the selector either per-project or even in global LSP-tailwincss settings if you don't expect to be using it with php projects.

@UltraInstinct05
Copy link
Author

I clearly see it as a bug. If a server has nothing to do with the project, it should not spin a new process. In the example, the folder has just some PHP files and nothing to do with Tailwind. Other servers don't start in workspaces that have nothing to do with them. I am not sure whether it's a client or a server problem here.

@rchl
Copy link
Member

rchl commented Jun 19, 2022

But we don't want to duplicate the logic of the language server that detects whether the project is using tailwindcss or not. And for the server to detect whether the project uses tailwindcss, it needs to be started.

It might be just better to disable LSP-tailwindcss globally and enable it per-project.

@UltraInstinct05
Copy link
Author

So can't the server stop if it detects that the project is not related to TW CSS ?

@rchl
Copy link
Member

rchl commented Jun 20, 2022

I believe that spec-wise there is no way for LSP server to request it to be shut down and its lifetime is controlled by the LSP client.

@deathaxe
Copy link
Contributor

deathaxe commented Oct 3, 2024

As the language server requires a valid tailwind.config.js to be present in order to do anything, I find the removed mechanism to check for its existance a suitable solution to not run a server for nonsense. Such a check could probably be implemented in a generic way by checking parent folders of an open file for existance of a config file to not rely on root directory being the top-level folder in ST's sidebar though.

@predragnikolic
Copy link
Member

The logic to prevent the server from starting in folders that do not have a tailwind.config.* file was removed to address #34

The logic could be brought back and tweaked so that #34 is not reintroduced again.

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

No branches or pull requests

4 participants