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

let LS detect workspace root after first file opened #562

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Konfekt
Copy link
Contributor

@Konfekt Konfekt commented Sep 28, 2024

Only set workspace root once the first file of that file type is opened; otherwise the workspace root often is $HOME or more generally different from the repo of the file (say when using Gvim, or generally opening a file in a Git repo different from the current work dir) and the LS scans too many files

Partially resolves 0 as ideally this workspace root would automatically change with the CWD, in particular after loading a session (:h mksession)

Only set workspace root once the first file of that file type is opened;
otherwise the workspace root often is $HOME (say when using Gvim, or
opening a file in a Git repo) and the LS scans too many files

Partially resolves [0]
as ideally this workspace root would automatically change with the CWD,
in particular after loading a session (:h mksession)

Links:

[0]: yegappan#512
@Konfekt
Copy link
Contributor Author

Konfekt commented Sep 28, 2024

If initializing the LS for a language as soon as a buffer of that language is opened sounds sensible, then the cleaner solution would be officializing that list of LSs (g:LspServers) and let the plug-in take care of adding the LSP and all commands buffer-locally. If this also sounds sensible, I could craft such a PR.

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

Successfully merging this pull request may close these issues.

lua lsp uses always current work dir when LSP initalized when editing file
1 participant