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

Clangd Integration #92

Closed
PatchByte opened this issue Sep 20, 2023 · 2 comments
Closed

Clangd Integration #92

PatchByte opened this issue Sep 20, 2023 · 2 comments

Comments

@PatchByte
Copy link

Especially for developing a clangd integration would be kinda good!
For example in vscode you can install the clangd extension and you are able to set a custom clangd path, maybe we could do hack where we have a custom clangd script lying in here that launches clangd in wine with msvc?

@vid512
Copy link

vid512 commented Dec 31, 2024

You can use native linux clangd, no need to run Windows clangd over wine.

When using msvc-wine/msvcenv-native.sh for building with native clang, and any build system that generates the compile_commands.json file, the clangd integration should be automatic.

You can also use clangd as a LSP on build which uses real MSVC compiler over wine. Of course, clangd's diagnostics will be bit different than real MSVC's, but as a LSP in IDE it is close enough. Same is true for IntelliSense vs. real MSVC in Visual Studio, anyway. You just have to provide a .clangd file with paths to include directories, eg.:

CompileFlags:
  Add:
    - "-Wno-pragma-pack"
    - "-I/opt/msvc/vc/tools/msvc/14.42.34433/atlmfc/include"
    - "-I/opt/msvc/vc/tools/msvc/14.42.34433/include"
    - "-I/opt/msvc/kits/10/include/10.0.22621.0/shared"
    - "-I/opt/msvc/kits/10/include/10.0.22621.0/ucrt"
    - "-I/opt/msvc/kits/10/include/10.0.22621.0/um"
    - "-I/opt/msvc/kits/10/include/10.0.22621.0/winrt"
    - "-I/opt/msvc/kits/10/include/10.0.22621.0/km"

I have tested this on example projects which use Meson build system. Out of curiosity, I tried opening the project in codium (VSCode minus telemetry and MS extensions). Clangd extension in codium worked fine out of box. Just make sure to start VSCode from terminal with msvc-wine environment set.

@PatchByte
Copy link
Author

Ah okay thank you a lot, before I opened this pr I did not know this was possible. Thank you a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants