-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor: update clangd root detection #1165
Conversation
If you want to have precedence, you can do something like the below: return function(...)
return require("lspconfig.util").root_pattern("Makefile")(...) or require("lspconfig.util").root_pattern("another pattern")(...) or --the others
end |
that's smart..thanks! |
6511b18
to
578b5da
Compare
updated, that should perform much better |
thanks! |
Now that "compile_commands.json" and "compile_flags.txt" are no longer the first default, I was surprised to see several clangd processes running in single file mode on a project with one CMakeLists.txt per folder. It's easy enough to restore the previous behavior, but @folke, @amaanq, was the default root path search order change expected? |
that's interesting, I guess there's no easy solution for this after all 😅, for me the original behavior was usually fine for projects purely in C, but add anything else like Rust and it can get wonky.. (which I usually work with) |
My concern is that projects with multiple CMakeLists.txt are common when following "modern" cmake practice. and IMO this change doesn't seem like a good default configuration for C++ development. Also by default, browsing throw such a code base will start spawning lot of clangd processes and probably gradually increase CPU usage, which may not be noticeable at fisrt since lsp/completion work as expected. Do you thing removing the search of CMakeLists.txt could provide better default for most C++ users without introducing issue with your way of working? |
we can remove CMakeLists.txt, I don't mind that, typically I work with Makefiles 😅 Or, just give CMakeLists.txt the same precedence as compile_commands.json/compile_flags.txt |
maybe a good idea to remove indeed. |
It'd be nice if there was a precedence associated w/ the ordering of arguments, but I don't think there is and it seems to match the most nested dir. That's not ideal for a lot of projects, like tree-sitter where compile_flags.txt is in
lib/
Suggestions welcome!