-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support code completion #13
Comments
Is this being worked on? this issue is relevant to #180 though. |
@sean-mcmanus @pieandcakes Anything in the roadmap? :) |
Yes, the IntelliSense engine will enable a better autocomplete (code completion) experience. It is being actively worked on now. It was delayed for a few months by work being done in Visual Studio 2017 (and other factors). |
@sean-mcmanus Nice to hear :) Looking forward to improvements on this already excellent extension! |
Code completion and Intellisense don't work what so ever in VSCode.. literally like it isn't even there. |
What plugin do you guys recommend using while this feature is not mature enough in vscode-cpptools? |
@bootsector I have no clue but I'am about to get rid of VSCode in my C projects. I just wrote a console app that builds and runs correctly but no output is shown in terminal and exits with code 0.. Like wtf? I put it in CodeBlocks, ran like a charm. That's so depressing.. |
Yeah, I wanted to get rid of Eclipse CDT for my C projects too, but I think I will have to stick with it a little more then... |
I'm also still facing an issue where my programs compile and run correctly but VSCode is telling me none of my header files are found. Highlighted red. But everything works. Still prints errors in terminal. Lol it needs polishing. |
We just posted an insider release with the finished auto-complete implementation. If you want to get an early preview, you can install the VSIX that matches your OS and tell us what you think. https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.16.0-insiders |
Local variables are now working correctly! 🎊 I also noted that I didn't need to define GNUC for the IntelliSense to start working. I only had to switch to clang-x64 for my ARM code to be supported! |
Yes, you shouldn't need to set the compiler's default defines anymore either. 😃 |
That's great. Auto complete now works for local variables. Are we going to support Go to Definition for local variables? |
@deanagan A fully functioning Go to Definition using the IntelliSense engine requires compilation of multiple translation units and is a major task that we plan to do eventually. Getting go to definition to work with IntelliSense only for local variables (or variables defined in the current translation unit) would be a minor task (you can see the definition/declaration is already found when you hover), but I'm not sure if we plan to spend the time to do that yet. |
Thanks for all the work done on this area, and I find no issues with using hover for local variables. However, I do want to point out that goto a local variable works really well for legacy code and benefits a lot of those programmers maintaining/refactoring functions/methods that are hundreds/thousands line long (I know it sucks to be a legacy code maintainer). |
Maybe that can be tracked in a new issue. |
I find that hovering over a local variable shows the definition, but "Go to definition", "Peek Definition", "Go to Declaration", and "Peek Declaration" all show "No definition found for 'variable'". As the hover works, why don't the other ones work? Using: |
@BillDenton Hover uses results from compiling the current translation unit. We could use the same system to give definitions/declarations for the current translation unit (a relatively small task), but it was decided not do that until we're able to give results for definitions that occur in other translation units (a relatively big task). Obviously, for the local variable case, there's no need to reference other translation units, but it was still decided not to implement yet (maybe if more people recommended we do this in the surveys?). |
We are tracking the go to definition issue with #255 |
what's supposed to work atm? Using C (not C++) with the following c_cpp_properties.json: {
"configurations": [
{
"name": "WSL",
"intelliSenseMode": "clang-x64",
"includePath": ["${workspaceFolder}", "${workspaceFolder}/include"],
"defines": ["__linux__", "__x86_64__"],
"browse": {
"path": ["${workspaceFolder}", "${workspaceFolder}/include"],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"cStandard": "c99",
"compilerPath": "${localappdata}/usr/bin/gcc -Wall -Werror -std=c99"
}
],
"version": 4
} on Windows 10, but compiling in WSL with gcc. Workspace Settings: {
"C_Cpp.intelliSenseEngine": "Tag Parser",
"C_Cpp.errorSquiggles": "Enabled",
"C_Cpp.intelliSenseEngineFallback": "Enabled",
}
these 10.000 issues being closed and circle-referencing each other and somehow this one are really confusing.^^ same with recognition of undefined function calls. |
You need to set "Tag Parser" is the old IntelliSense engine which doesn't support local variables, doesn't do error squiggles, and doesn't have type information so it suggests everything. |
I've read multiple times about this, and must've kept the wrong setting, thank you. libpng's functions are now suggested but it tells me stuff like |
I don't know libpng very well. Do you have a sample I can clone or download? |
Oh, it works now, seems like the headers weren't crawled or something. Alrighty, I can work with this. Thanks for the fast responses! 👍 |
This is so weird.. the definitions disappeared somehow.. I installed libpng via #include <png.h>
int main(int argc, char **argv)
{
png_byte a = 13;
return 0;
}
in addition to my config from before, this is my c_cpp_properties.json now: {
"configurations": [
{
"name": "WSL",
"intelliSenseMode": "clang-x64",
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}/include",
"${localappdata}/usr/local/include",
"${localappdata}/usr/include/x86_64-linux-gnu",
"${localappdata}/usr/include"
],
"defines": ["__linux__", "__x86_64__"],
"browse": {
"path": [
"${workspaceFolder}/*",
"${localappdata}/usr/local/include/*",
"${localappdata}/usr/include/x86_64-linux-gnu/*",
"${localappdata}/usr/include/*"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"cStandard": "c99",
"compilerPath": "${localappdata}/usr/bin/gcc -Wall -Werror -std=c99"
}
],
"version": 4
} |
It looks like libpng is not in your include path. You will either need to add BTW, your config can be simplified. You shouldn't list the system include paths if you set
|
thanks for the intel, it works as expected now! :) |
Keep getting the wrong members after a dereference: on Ubuntu 16.04. The hints proposed by intellisense are from all the classes I have in the workspace (very large list), instead Touch class members. C_cpp_properties.json includes the paths of all the workspace (which contains the class Touch): {
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
} The configuration of intellisense is set as Default "C_Cpp.intelliSenseEngineFallback": "Disabled",
"C_Cpp.intelliSenseEngine": "Default" Resseting the intellisense Database, reopening the vsCode, etc. But keeps showing all the stuff I have in the workspace. |
@guillemmr It's preferred to file a new bug instead of adding it to a close issue. My best guess is that the IntelliSense process could be crashing. Can you enable logging and see if there are error messages? |
Similar to how the extension C/C++ Clang supports code completion, wouldn't this be within the scope of this extension?
The text was updated successfully, but these errors were encountered: