online icon indicating copy to clipboard operation
online copied to clipboard

cool#9772: VSCodium/clangd: Add generation of .clangd and .vscode files to ease editing via IDE/language-server

Open sgothel opened this issue 1 year ago • 4 comments

Change-Id: Ic53e554598302e0b5e67568c6b72b9be1bd890a4

  • Resolves: #9772
  • Target version: master

Summary

Initial integration of .clangd via make gen-clangd and vscode via make gen-vscode, for

  • compile_commands.json
    • already supported via make compile_commands
    • fixed with earlier commit
  • .clangd
    • in addition to compile_commands.json (CompileFlags), allowing setting include defaults, workspace-dir as well as other clangd settings: Index, Diagnostics (clang-tidy IDE setup), InlayHints (IDE), Hover (IDE).
  • .vscode/settings.json
    • VSCodium workspace settings (actually empty)
  • .vscode/online.code-workspace
    • VSCodium workspace project file (proposal)

New make targets:

  • gen-clangd Produces .clangd and compile_commands.json files
  • gen-vscode Produces .clangd and and compile_commands.json files and .vscode directory.
  • clean-clangd removes .clangd file.
  • clean-vscode removes .clangd file and .vscode directory.

Note: The clang* setup has been tested with

  • VSCodium Version: 1.91.1, Release: 24193, Commit: 8512cb3341b26a5dba985a9a17eed8d7c3362886, Date: 2024-07-11T18:37:10.462Z
  • Eclipse cdt-jsp: C/C++ LSP Support , 2.1.0.202408070815, org.eclipse.cdt.lsp.feature.feature.group, Eclipse CDT

TODO

Maybe we can refine

  • Documentation (manuals or wiki) ?

Checklist

  • [X] I have run make prettier-write and formatted the code.
  • [x] All commits have Change-Id
  • [x] I have run tests with make check
  • [x] I have issued make run and manually verified that everything looks okay
  • [ ] Documentation (manuals or wiki) has been updated or is not required

sgothel avatar Aug 10 '24 00:08 sgothel

Thanks for opening this pull request!

Things that will help get your PR across the finish line:

  • Check out our contributing guidelines.
  • Connect with us through one of our communication channels.
  • Click on the details link next to the failing CI checks, if any, to see an explanation on how to fix it.
  • Feel free to ping @pedropintosilva or the mentor of the easyHack you are solving if you need help.

welcome[bot] avatar Aug 10 '24 00:08 welcome[bot]

  • force pushed with 2 commits
  • updated description (aligned with commit 988f6b3f19e080b712cc1aee43747c6b898e259d)

sgothel avatar Aug 14 '24 07:08 sgothel

re .clangd file:

in addition to compile_commands.json (CompileFlags), allowing setting include defaults, workspace-dir as well as other clangd settings: Index, Diagnostics (clang-tidy IDE setup), InlayHints (IDE), Hover (IDE).

Essentially the CompileFlags are similar if not same, but added the APP_NAME. We could make them actually the very same. Would allow having same flags for files not reflected by compile_commands.json

The other mentioned use case are for better mentioned indexing and IDE integration, i.e. https://clangd.llvm.org/config

sgothel avatar Aug 14 '24 13:08 sgothel

Will revise CompileFlags in .clangd to match compiler_commands.json 100% .. i.e. reuse the settings from Makefile.am.

sgothel avatar Aug 14 '24 13:08 sgothel

Hello Sven, is this PR is good to merge in this green cycle release ? If yes, then please can you rebase and merge it ?

Darshan-upadhyay1110 avatar Sep 05 '24 13:09 Darshan-upadhyay1110

Hello Sven, is this PR is good to merge in this green cycle release ? If yes, then please can you rebase and merge it ?

Yeah, just cleaned up the clangd.am config (hardcoded path -> @macro_name@ ... oops) and rebased. Ready to be merged IMHO.

sgothel avatar Sep 09 '24 08:09 sgothel