I just downloaded visual studio code for linux ubuntu 14.04. I created a simple test.cpp and wrote it in vscode and the intellisense did not work.
Here is the code inside test.cpp:
struct test{
int a = 5;
}
int main(){
test t;
t.
}
There was no intellisense telling me the members of t when I wrote "t." and there should have been.
I created the test.cpp file in the linux terminal with the command "touch test.cpp" then I opened test.cpp with visual studio code and wrote the code. A screenshot can be seen here: http://i.stack.imgur.com/fLhSA.png
Anyone know how to get intellisense working for vscode in linux?
Starting in version 0.12. 3 of the extension, there is a command to reset your IntelliSense database. Open the Command Palette (Ctrl+Shift+P) and choose the C/C++: Reset IntelliSense Database command.
To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.
Why is VS Code suggestions not working? If you're coding in JavaScript or TypeScript and finds that VSCode IntelliSense does work but does not behave properly, it's likely that you've selected the wrong language mode. TypeScript and JavaScript share the same language service, so you need to select the right language.
Please try: Go to Visual Studio Installer, click Modify , uncheck IntelliCode in Individual components, then click Modify button to save the change, wait for the installation to complete, and then reinstall IntelliCode . In Visual Studio, go to Tools->Options->IntelliCode to check if the setting is Default.
As the others suggested you can now add the C/C++ extension.
You might run into the following two issues with the extension:
The extension does not detect custom libraries:
You have to add the include paths of the custom libs. Do the following:
Ctr + Shift + P
C/C++ Extension: Configuration
Incude Paths (add one path per line, e.g.)
${workspaceFolder}/**
/home/me/Documents/my_custom_lib/
The extension suddenly stops to give you any suggestions no more:
This might happen if you do not open the project root, but a child of it. Open the project root folder and reload the window.
The following applies mainly if using ROS1, using the C/C++ extension for vscode:
In the file .vscode/c_cpp_properties.json
(generated by the VSCode ROS extension), try to change from "cppStandard": "gnu++14"
to "cppStandard": "c++14"
.
The file would look something like that:
{
"configurations": [
{
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/home/user/catkin_ws/devel/include/**",
"/opt/ros/melodic/include/**",
...,
"/usr/include/**"
],
"name": "ROS",
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++14"
}
],
"version": 4
}
ROS is using the c++14 standard, so specifying gnu++14
seems to break things. This was deduced from this question.
An issue exists about this (now closed).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With