I am looking for a visual studio code's plugin for c++ has feature that auto complete/add include header when writing code. Any suggestion?
Place your caret on the first line of any C# or Visual Basic file. Press Ctrl+. to trigger the Quick Actions and Refactorings menu. Select Add file header. To apply the file header to an entire project or solution, select Project or Solution under the Fix all occurrences in: option.
The suggestion list of Automatic completion appears as soon as you start typing a new identifier. The suggestion list of Basic completion appears when you press the default Visual Studio IntelliSense shortcut Ctrl+Space .
If you don't see the expected output or g++ or gdb is not a recognized command, make sure your PATH entry matches the Mingw-w64 binary location where the compilers are located. If the compilers do not exist at that PATH entry, make sure you followed the instructions on the MSYS2 website to install Mingw-w64.
Actually, there isn't any extension like what you exactly want, but you can create your own desired option without any extension and only using USER-SNIPPETS. To do this:
open visual studio code
> File
> Preferences
> User Snippets
: here you can create a new user snippets file or use an existing one, if you are new you might don't have any hence create a fresh one(make sure it is for c++), then put your desired snippets, here's mine as an example:
"Add iostream & string": {
"prefix": "#include",
"body": [
"#include <iostream>",
"#include <string>",
""
],
"description": "Add iostream & string"
}
after whenever you type #inc
in a .cpp
file a snippet will be shown for you and you can accept that.
but if you mean what Deepak Punjabi said, considering that c++ has a huge amount of libraries it isn't actually intellectual to do such a thing. searching a huge huge bunch of libraries to just include a header. the feature you are looking for somehow is a compiler feature which some languages like python meet the needs better.
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