@mcgordonite/theia-cpp v0.3.19-test.2
Theia - Cpp Extension
This extension uses Clangd to provide LSP features.
To install Clangd on Ubuntu 18.04:
$ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
$ echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee /etc/apt/sources.list.d/llvm.list
$ sudo apt-get update && sudo apt-get install -y clang-tools-8
$ sudo ln -s /usr/bin/clangd-8 /usr/bin/clangd
See here for detailed installation instructions.
To get accurate diagnostics, it helps to:
- Have the build system of the C/C++ project generate a
compile_commands.json
file. - Point Clangd to the build directory containing said
compile_commands.json
. - Set path to Clangd executable.
- Set arguments to pass to clangd when starting the language server.
#2 can be done using the cpp.buildConfigurations
preference. In your home
or your project .theia/settings.json
, define one or more build
configurations:
{
"cpp.buildConfigurations": [{
"name": "Release",
"directory": "/path/to/my/release/build"
},{
"name": "Debug",
"directory": "/path/to/my/debug/build"
}]
}
You can then select an active configuration using the
C/C++: Change Build Configuration
command from the command palette.
#3 can be done either by:
- Setting
CPP_CLANGD_COMMAND
environment variable Adding
cpp.clangdExecutable
preference in your home or your project.theia/settings.json
:{ "cpp.clangdExecutable": "/path/to/my/clangd/executable" }
Adding clangd to system path. Default value of executable path is set to
clangd
#4 can be done either by:
- Setting
CPP_CLANGD_ARGS
environment variable Adding
cpp.clangdArgs
preference in your home or your project.theia/settings.json
:{ "cpp.clangdArgs": "list of clangd arguments" }
License
6 years ago