home.social

#clangd — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #clangd, aggregated by home.social.

fetched live
  1. Quick and dirty VSCode project for WSL/Ubuntu for getting started with coding in #C for #C64 :
    codeberg.org/csepp/llvm-mos-sa

    Made for my partner and generally for people who might be new to C and for some reason want to learn it while they also learn Commodore 64 programming. She hasn't tried it yet, so I can't vouch for the followability of the docs.

    Uses #LLVMMOS / #Clang / #clangd to make things a bit more ergonomic. I know about CC65 and its debug info and VICE support was tempting, but better code navigation and static analysis IMHO wins.

    PRs that set up support for other IDEs are welcome, as long as they don't break VSCode.

    cc: #theWorkshop

  2. I really hate using VS Code for... well, anything, really.

    Thing is, I haven't yet worked out how to set up #NeoVim and #clangd for #PlatformIO and #Arduino projects. I'm guessing the Pico SDK is going to be equally as awkward when I get around to it.

    Plus, there's no way to get clangd to properly interpret Psion's old 16-bit DOS-influenced C. If LLVM can't compile it, clangd doesn't seem to care about it.

  3. Does anyone have any tips on using #clangd with the #Arduino libraries? Specifically for use in #NeoVim.

    At some point I'll move this project over to the Pico SDK, but for now I'd like to edit this code without resorting to VS Code.

    #AskFedi #LazyWeb #hivemind

  4. is has issues when module import is in a header file, and not the cpp file. This is not a problem for clang, its all in the same translation unit. AFAICT this is legal and fine C++20 module code, clangd shouldn't have this issue.

    github.com/llvm/llvm-project/i

  5. Other projects I use every day:
    #Matrix spec & clients like #FluffyChat and #nheko
    #Bitwarden & #Vaultwarden password manager
    #Neovim text editor
    #clangd LSP

    I'd love to encourage these projects to jump ship, and I celebrate those that do. I am much more likely to provide quality contributions if you host on your own forge, or a free one, and I am sure I'm not alone in this.

    GitHub is hostile to FOSS and, despite giving away lots of free-of-cost stuff I believe ultimately hurts us.

  6. Random pro-tip: if you want use clangd on project, make sure it builds with clang when generating the compile-commands.json file.

    But sometimes the projects don't build with clang (I was recently looking at ipxe), and working with gcc build commands might be enough, at least on x86_64.
    But on arm64, a specific flags was passed, -mabi=lp64. You can configure clangd to skip those flags on a per-project basis:
    github.com/clangd/clangd/issue

    #clangd #arm64

  7. I was fighting with #lsp-mode in #emacs to get it to use my system #clangd and failed. But I discovered #eglot-mode which picked it up fine and I much prefer the #ui choices they have made. How long has it been in core Emacs?

  8. #TIL #clangd (the #LSP) doesn't seem to find system libraries if the path is not explicitly added to #clang (the compiler).

    So here I am unnecessarily sprinkling `-I/usr/local/include` everywhere.

  9. So... apparently the compile_commands.json generated by #clang with `-MJ compile_commands.json` has invalid syntax so #clangd fails (silently) to load it.
    And even after fixing it manually I get a lot of "Unknown argument" errors.
    I'm not even working on a big project. This is just a single .cpp file. Not even a header.
    It's all tools from the #LLVM project. I'm not doing anything fancy!
    This is so frustrating. 🤬

  10. @pythno #clangd is a LSP for c language and c++. So, if you don't install clangd it'll not work.

    #neovim

  11. @pythno Try ...
    1. Install #clangd but don't setup LSP. This will disable auto completions.
    2. Use #codelldb for debugging -> igorlfs.github.io/neovim-cpp-d

    #neovim

  12. Anyone here using #clangd and clang-format for #cpp and could help me with a format setting that would make operator chains put one per line?

    Imagine this is too long for 1 line:

    foo().bar().baz()

    I want to chain transformers like so:

    foo()
    .bar()
    .baz()

    But with LLVM settings, clang-format currently tries to use as few lines as possible, so I get either

    foo().bar()
    .baz()

    or

    foo()
    .bar().baz()

    depending on where I hit return with auto-formatting enabled

  13. I'm now convinced that I'm not going to be able to get #clangd to behave properly with C89 code for 8086.

    It might be a skill issue on my part, but there's only so much time I want to spend getting my tooling working.

    Until I have a better solution, I'll have to stick with VS Code.

    #retrocomputing #retrodev #NeoVim

  14. Is anyone out there using #NeoVim for #retrodev in C, specifically 16-bit x86 (e.g. DOS)?

    Do you also have a working language server?

    I'm hitting some snags trying to configure #clangd that I just don't have with VS Code. (e.g. recognising cdecl)

    Also willing to hear from people using other editors!

    EDIT: This is actually for Psion EPOC16 development, but the TopSpeed C compiler runs in DOS and uses DOS conventions to make 8086 binaries. The Psion SIBO C SDK then strips the MZ header and adds an EPOC16 one.

    #retrocomputing #msdos

  15. My next #NeoVim related challenge is to work out how to get #clangd to work with the #Psion SIBO C SDK.

    It's probably going to involve #cmake, something I've successfully avoided for some time now.

    Needs must, as they say.

  16. fyi: #nvim 0.10.2-2, #cocnvim 0.0.82, coc-clangd 0.31.0, #clangd 18.1.8

    I WANNA REFACTOR!!! Y R U NOT LETTING ME REFACTOR GRRRRR

    mfw coc-codeaction-refactor is doing jackshit to coc-clangd grrrrrrr

    #cpp

  17. Is anyone using #NeoVim with #clangd for #retrodev with early-90s C libraries? I can't make head nor tail of the documentation.

    So far for my .clangd file I've got something like this:

    CompileFlags:
    Add:
    "-I/home/alex/dosbox/sibo-c/SIBOSDK/include"

    But I don't think this is actually doing the job of setting the path, not to mention ignoring all other (more modern) include paths. I also need to set C89 and maybe tell it that it needs treat the code as something vaguely DOS-like.

    What's really galling is that this is very easy with VS Code and just bloody works -- one JSON file that it practically fills in for you and you're done.

    EDIT: To clarify, the build environment is inside DOSBox (TopSpeed C compiler, Psion SIBO C SDK), so I don't think tools like bear will work (though I'm happy to be proved wrong!).

    EDIT 2: Fixed the path in the code snippet (which I changed originally for essentially no reason).

    #retrocomputing #clang #llvm

  18. Hi diddly-dee,
    It's #LazyVim for me!

    Swapped my very basic config with LazyVim and I'm very happy!

    Next steps are:
    - Easy swapping of LSP (mainly #clangd) configs so that I can switch between targeted platforms (e.g. Windows and Linux, or Arduino UNO and RP2040)
    - Integration with #PlatformIO
    - Some way to side-by-side compare and modify git untracked changes

    These are all things I have in VSCode, the target changing being the most important. I hope that there are equivalents for #NeoVim!

  19. Day 2 of #AdventOfCode or #AdventOfCpp

    Loads going on here, mostly a complete rewrite of the runner, splitting strings, some `struct` some more `regex`. Feels like I'm getting the hang of it.... though I needed #clangd reminding me to stop passing objects by value.
    github.com/mattjbones/advent-o

  20. So.. #clangd is a thing and I started using it and the #VSCode has come alive with argument annotations and way more feedback on the C-style #cpp that I'm writing.

  21. Seems #flatpak and #clangd doesnt work well together.

    Clangd tries to read files from /usr/include and flatpak sandboxes that and anything it sees in /usr/include are actually in some flatpak sandbox place.

    Exposing /usr/include in flatseal to the editor that uses clangd doesnt do anything