-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Core] Add bazel run :refresh_compile_commands for clangd #47964
Conversation
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
Hi, what's difference vs Lines 36 to 38 in 61a4220
|
Signed-off-by: dayshah <[email protected]>
So I actually did try this but it fails because it isn't targeted specifically towards cpp code, so it tries to generate for the java code and fails. New one will just gen for the cpp code under ray_pkg. The new one also turns off generating for external sources by default, because it causes clangd to index almost 5k files instead of just 400 which takes like 30 mins vs. <5 mins. Just removed the comment there too, so people are directed towards the new command. |
Thanks. But if we disable external code indexing, will clangd lsp still work for e.g. asio or protobuf-generated code? |
Signed-off-by: dayshah <[email protected]>
Ok so correction to my previous comment, this actually still causes a 4k index (i think i had some cache before), it still indexes the external headers just not cc files, so can still click into .pb.h files and other absl or boost headers. The full index without exclude_external_sources is close to 10k. And then there's one more possible option exclude_headers which would actually exclude the external headers which we don't want. Updated comment to reflect 2x, not 10x index time |
I think the external .cc file indexes are still useful for some devs since when debugging asio I sometimes click into them to see the details. But it slows down as you said. Would you mind making a command flag or another command to also enable external file indexing? Then I will merge this PR. |
Signed-off-by: dayshah <[email protected]>
Signed-off-by: dayshah <[email protected]>
makes sense, i added a second command so bazel run :refresh_compile_commands_external_sources will do it with the external sources while the standard command won't, comments for info are there too |
…t#47964) Gives clangd the ability to fully index ray's c++ code after you run ```bazel run :refresh_compile_commands```. Gives you lsp support + clang-tidy linting in ide to catch bad cpp practices in files based on rules already setup in .clang-tidy. https://github.com/ray-project/ray/blob/master/.clang-tidy A lot of these don't seem to be followed though and seem contrary to some of the style of existing code, but some are critical for not giving up performance gains off of small things. Trimming down to more important lints could be helpful. Signed-off-by: dayshah <[email protected]> Co-authored-by: Ruiyang Wang <[email protected]>
…t#47964) Gives clangd the ability to fully index ray's c++ code after you run ```bazel run :refresh_compile_commands```. Gives you lsp support + clang-tidy linting in ide to catch bad cpp practices in files based on rules already setup in .clang-tidy. https://github.com/ray-project/ray/blob/master/.clang-tidy A lot of these don't seem to be followed though and seem contrary to some of the style of existing code, but some are critical for not giving up performance gains off of small things. Trimming down to more important lints could be helpful. Signed-off-by: dayshah <[email protected]> Co-authored-by: Ruiyang Wang <[email protected]>
…t#47964) Gives clangd the ability to fully index ray's c++ code after you run ```bazel run :refresh_compile_commands```. Gives you lsp support + clang-tidy linting in ide to catch bad cpp practices in files based on rules already setup in .clang-tidy. https://github.com/ray-project/ray/blob/master/.clang-tidy A lot of these don't seem to be followed though and seem contrary to some of the style of existing code, but some are critical for not giving up performance gains off of small things. Trimming down to more important lints could be helpful. Signed-off-by: dayshah <[email protected]> Co-authored-by: Ruiyang Wang <[email protected]> Signed-off-by: mohitjain2504 <[email protected]>
Why are these changes needed?
Gives clangd the ability to fully index ray's c++ code after you run
bazel run :refresh_compile_commands
. Gives you lsp support + clang-tidy linting in ide to catch bad cpp practices in files based on rules already setup in .clang-tidy. https://github.com/ray-project/ray/blob/master/.clang-tidy A lot of these don't seem to be followed though and seem contrary to some of the style of existing code, but some are critical for not giving up performance gains off of small things. Trimming down to more important lints could be helpful.Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.