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

fix: do not always autostart servers with explicit user config #6

Open
WieeRd opened this issue Oct 10, 2024 · 0 comments
Open

fix: do not always autostart servers with explicit user config #6

WieeRd opened this issue Oct 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@WieeRd
Copy link
Owner

WieeRd commented Oct 10, 2024

Current State

When an explicit configuration is given for a server through setup(), availability check for that server is skipped, and it will be always setup when an associated filetype is triggered. The rationale behind this is that some server configurations in lspconfig dynamically changes cmd based on other fields or environment variables. It is hard to predict what the actual cmd is going to be. So I choose to skip the executable check in order to avoid false negatives of not picking up actually available servers.

Problem

False positives. After deploying my dotfiles on fresh Arch setup, opening nvim config immediately resulted in auto-lsp trying to setup lua_ls and failing, because I have explicit configs for lua_ls but didn't have it installed yet. It's only mildly annoying, but I'd still like to get rid of it.

Solution

some server configurations in lspconfig dynamically changes cmd based on other fields or environment variables.

Turns out there is a clear sign that tells this will happen or not. The on_new_config field is responsible for dynamic adjustments to the default config. I can take note if this field is present when iterating through configs during mappings generation. "Always setup if explicit user config is given" should be only applied to these servers.

@WieeRd WieeRd added the enhancement New feature or request label Oct 10, 2024
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

1 participant