Follow the Compilation Database instructions below to create the appropriate project description file in the fuchsia root directory.
Then in CLion choose Import Project from Sources and select the fuchsia root directory.
CLion Performance Tweaks
To improve performance you can try some or all of the following. They are only suggestions, we recommend checking with directly with JetBrains at https://intellij-support.jetbrains.com/hc to be sure what works best for your environment.
To speed up indexing time you can exclude directories you are not
working with. You can do that in the Project View by
right-clicking each directory and choosing
Mark directory as->Excluded. Note the affected configuration is stored
See Control Source, Library, and Exclude Directories - Help | CLion for more information.
Unregister Git Repositories
The fuchsia source tree has a fair number of git repositories. Scanning them can use CPU cycles for CLion. You can unregister the git repositories you are not working on under File -> Settings -> Version Control. They will still be listed there so you can add them back later if needed.
Tune JVM Options and Platform Properties
See Tuning CLion - Help | CLion for general tips on tweaking CLion JVM Options and Platform Properties. As that link suggests, contact CLion support for instructions regarding the options and values that might help you with whatever issue you are trying to solve.
Visual Studio Code (VS Code)
There are multiple VS Code setups known to work to different degrees. The sections below describe the different setups (pick one).
Install vscode-clangd. Disable the default C/C++ extension if you have it installed.
In settings, add:
"clangd.path": "<absolute path to fuchsia root directory>/prebuilt/third_party/clang/<platform>/bin/clangd",
Finally, follow the Compilation Database instructions below to
compile_commands.json in the fuchsia root directory. Then
reload VS Code to enjoy the results.
You may also benefit from enabling background indexing and clang-tidy using the following settings:
"clangd.arguments": [ "-clang-tidy", "-background-index" ]
Further details on clangd setup can be found here.
Default VS Code C++ extension
Install the default C/C++ extension suggested by VS Code.
You can use tasks to configure a compilation step.
Compilation Database (fx compdb)
can be generated using
fx compdb. This will create/update the file
compile_commands.json in the fuchsia root directory. When you add,
delete, or rename source files the command needs to be rerun to update
Note that this file is only intended to help the IDE find and parse
the source files. Building should still be done with
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-12-12.