zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.52k stars 3.02k forks source link

bug in the front end compiler in c #17793

Closed ElAv252 closed 1 month ago

ElAv252 commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I have an issue that the "Problem diagnostic" show me that I have some errors in the code, but actually I don't.

I would love for you to look into the matter, thank you very much!!

Environment

Model Name: MacBook Pro Chip: Apple M1 Pro Memory: 16 GB

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


jansol commented 1 month ago

The C diagnostics are provided by clangd, which is a 3rd party tool. If you use compiler flags that are not defaults for your version of clangd (such as a new language version - Apple is somewhat notorious for shipping an outdated version of the LLVM toolchain!), you may have to tell clangd what flags to build with. Or if your project uses something like cmake/meson/premake to generate build files, those tools can be instructed to generate a compile_commands.json with all the necessary flags on a per-source-file basis.

ElAv252 commented 1 month ago

I used gcc compiler...

And i show the erros in the "Problem diagnostic" panel of zed.

jansol commented 1 month ago

What compiler you use for actually building your code is irrelevant. You need to tell the language server what flags to build with so that the language server can do its thing correctly.

ElAv252 commented 1 month ago

Ok, got it. Thanks!