-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 texlab#GetProjectRoot #3610
Conversation
ale_linters/tex/texlab.vim
Outdated
return '' | ||
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') | ||
|
||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : fnamemodify(a:buffer, ':h') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning the directory of the current buffer when no .git directory is found may cause ALE to spawn an instance of the language server for every tex file open. See the comment about this: #2501 (comment)
Here would be better to return an empty string if no root is found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I personally didn't mind an LSP server starting for every tex file, but I agree it would not be preferred as the default. I will fix that now, and I'll also try to fix the tests after I understand them more.
please fix the failing test so I can merge this:
|
Previously, the function returned `../.git/`. We want the function to return the parent directory above that as the project root. This should help pass Vader tests.
@hsanson Tests should be fixed now. Thank you for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Thanks.
* master: (214 commits) improve DMD handler (dense-analysis#3647) Add support for V: "v" (compiler) and "vfmt" fixer. (dense-analysis#3622) Add nixfmt as a Nix fixer. (dense-analysis#3651) Switch to using buildifier's -path option (dense-analysis#3640) Add support for `ptop` fixer (dense-analysis#3652) Add more parameters to the DMD linting command (dense-analysis#3639) dense-analysis#3633 - Move linter tests into test/linter Allow more time before PRs become stale Add support for clangd with CUDA (dense-analysis#3598) add support for svelte via svelteserver language server (dense-analysis#3644) dense-analysis#3633 - Put all dummy test files in test/test-files Add desktop-file-validate Fix a typo in a test filename issue 3033 (dense-analysis#3620) dense-analysis#3632 Add ale#util#MapMatches Fix ale#path#Dirname on Windows Disable blank issues and add a link to ask for help Check user systemd unit files with systemd-analyze Close dense-analysis#2102 - Add support for the Angular language server Fix texlab#GetProjectRoot (dense-analysis#3610) ...
This fixes the texlab#GetProjectRoot function based on the discussion in #2501 of using a .git folder as an indicator of a TeX project root. This should address the issue of the texlab LSP server not starting at all, as raised by #2790 and #2699