Skip to content

Add a build rule which produces compile_commands.json for clangd#4229

Open
SandSnip3r wants to merge 1 commit intopytorch:mainfrom
SandSnip3r:add-compile-commands
Open

Add a build rule which produces compile_commands.json for clangd#4229
SandSnip3r wants to merge 1 commit intopytorch:mainfrom
SandSnip3r:add-compile-commands

Conversation

@SandSnip3r
Copy link
Copy Markdown
Contributor

Description

When using VSCode-based editors (but not VSCode), clangd is the language server of choice. This PR adds a new build rule which generates a compile_commands.json file which can be used by clangd. This enables code navigation in the IDE easily.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@meta-cla meta-cla Bot added the cla signed label May 1, 2026
@github-actions github-actions Bot added the component: build system Issues re: Build system label May 1, 2026
@github-actions github-actions Bot requested a review from lanluo-nvidia May 1, 2026 00:22
Copy link
Copy Markdown
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks cool, will let @lanluo-nvidia or @apbose do the final approve and merge

@apbose
Copy link
Copy Markdown
Collaborator

apbose commented May 1, 2026

The CI is failing. I believe adding the same dependancy to toolchains/ci_workspaces/MODULE.bazel.tmpl should resolve this, or you could have a separate subpackage for clangd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants