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

is there any idf command option to generate cscope.files or compile_commands.json file ? (IDFGH-14559) #15318

Open
iysheng opened this issue Feb 2, 2025 · 4 comments
Labels
Status: Opened Issue is new Type: Feature Request Feature request for IDF

Comments

@iysheng
Copy link

iysheng commented Feb 2, 2025

Is your feature request related to a problem?

I always use vim to develop with idf. I found it's hard to jump when view these code. So I wonder is there any command option to genrate cscope.files or compile_commands.json file to achive jump with cscope tool or clangd ?

Describe the solution you'd like.

No response

Describe alternatives you've considered.

No response

Additional context.

No response

@iysheng iysheng added the Type: Feature Request Feature request for IDF label Feb 2, 2025
@github-actions github-actions bot changed the title is there any idf command option to generate cscope.files or compile_commands.json file ? is there any idf command option to generate cscope.files or compile_commands.json file ? (IDFGH-14559) Feb 2, 2025
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 2, 2025
@dobairoland
Copy link
Collaborator

Hi @iysheng. If you run idf.py reconfigure or idf.py build then build/compile_commands.json should be available in your project. It looks like the Vscode extension also uses it (https://developer.espressif.com/blog/vscode-esp-idf-v1.8.0/#code-navigation-without-full-project-build). Please let us know if this works for you.

I don't think we have support for generating cscope.files right now.

@igrr
Copy link
Member

igrr commented Feb 3, 2025

And if you need tips on configuring clangd, please check #6721 for recipes.

@iysheng
Copy link
Author

iysheng commented Feb 5, 2025

And if you need tips on configuring clangd, please check #6721 for recipes.

tks, I viewed this issue #6721 .
First I do command ln -s build/compile_commands.json . to link build/compile_commands.json file in project root dirctory.
Then I create .clangd file in project root file which has build directory. and add theses content in the .clangd file, now it's ok.

CompileFlags:
  # adjust for your compile_commands.json location
  CompilationDatabase: build/
  Remove:
    [
      -fno-tree-switch-conversion,
      -mtext-section-literals,
      -fstrict-volatile-bitfields,
      -mlong-calls,
      -fno-shrink-wrap,
      -march=rv32imc_zicsr_zifencei,
    ]

Besides, I wonder that though I have set CompilationDatabase: build/ in .clangd file , But if there is no compile_commands.json file in project root dirctory, I still couldn't do function jump.

@iysheng
Copy link
Author

iysheng commented Feb 5, 2025

I found another issue, when I want to jump esp_board_init function defination. I just jump to the function def in the header file hardware_driver/include/esp_board_init.h. How could this happen ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

4 participants