- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: Enable Clangd in repo #6430
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🫡
I want to use IT!
generator_script_path = '../../../packages/react-native-reanimated/scripts/clangd-generate-xcode-metadata.sh' | ||
|
||
script_phase :name => 'Generate metadata for clangd', :script => generator_script_path, :shell_path => '/bin/bash', :always_out_of_date => 'true', :execution_position => :after_compile | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline at the end of file, not very nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributions are welcome 🤗
## Description This pull request introduces `clangd` support. You can read more about it in [this](software-mansion/react-native-reanimated#6430) awesome PR that bring it to reanimated. For now it supports iOS only as I am not sure if we need it for android here. To make it work, you have build `FabricExample` or `MacOSExample` first. <!-- Description and motivation for this PR. Include 'Fixes #<number>' if this is fixing some issue. --> <!-- Describe how did you test this change here. -->
Summary
Bringing
clangd
to our monorepo.What's clangd?
It's a language server that plugs into your text editor (yes, I'm looking at you VSCode) and provides you with syntax highlighting, autocompletion, inspections and much more. You can read about it on clangd's webpage.
Why do we need this?
Often times when we develop C++ code, we have to jump between Xcode and Android Studio just to get autosuggestions or be able to inspect some functions. This slows down development and these IDEs have their downsides.
With this change, you'll be able to edit the code in VSCode and have all the necessary information there, including static checks. In my experience it also works much faster than native IDEs.
Just to name a few useful features:
How do I use it?
I automated the whole pipeline for clangd, so all you need to do is install VSCode's clangd extension.
You also need to compile the project once to generate all the artifacts utilized by clangd. For example, if you are developing for Fabric, iOS, just build FabricExample.
As a bonus, built-in VSCode's C++ plugin also benefits from this, so you don't need to use clangd at all. However, I still recommend clangd as a replacement. Try it out yourself!
Before:

After:

Test plan
🚀