Visual studio C++ plugin that formats the code following some rules - c++

Somebody knows if exists some plugin for visual studio C++ that acts like the formatter and clean up profiles of Eclipse?
I want something that formats my code following some predefined rules like:
put const in function when possible
don't allow empty lines
don't allow functions do pass 100 lines

I don't have any experience with such utilities, but you can search for code cleanup add-ons at the Visual Studio Gallery: http://msdn.microsoft.com/vstudio

Related

Visual Studio C++ Document Outline

I have CMake C++ projects in Visual Studio 2022 and would like to view the document outline for cpp/h files. But the Document Outline view is not available for this file type:
In VS Code, with the C++ extensions installed, there is a nice outline view:
But for various reasons, I need to use Visual Studio (not VS Code). I have diligently searched the extensions on Visual Studio Marketplace and found nothing that does this. It is surprising that as powerful as Visual Studio is, there is no outline view for C++ files. It seems like such an obvious feature -- I can't possibly be the only one who has ever needed it. Does anyone know of an extension for this?

How do i change the colours of visual studio? [New user]

Im currently a C++ student in uni. I started using visual studio code configurated by a friend and then i changed to visual studio 2022 (the community version).
In visual studio code the code looks prrety much like this:
Then in visual studio it looks like this:
Does anyone know how to change the highlighted or at least can give me a hint? thanks!
I tried looking in the settings on visual studio but i got confused since there are many options and i dont know exactly what to change
You are probably looking for the Visual Studio Theme Pack extension, which brings the default VS code themes to VS. Also see this blog post for other converted popular VS code themes, and this blog post which describes a tool to convert any VS code theme.
Regarding the colored (rainbow) braces, there is the "Rainbow Braces" extension (corresponding blog post).
For further configuration, you might also want to have a look at the Visfora extension, which also includes rainbow braces.
Extensions aside, many of the colors can also be manually and individually configured in the Visual Studio's options → Environment → Fonts and Colors.

Basic ANTLR4 use in Visual Studio 2017 (C++)

I'm trying to use ANTLR4 in Visual Studio 2018 (C++, Windows 10), and I simply do not understand what to do, despite reading the getting started and the C++ target readme, and looking at a dozen other places.
I can take the grammar suggested from the getting started page, and use the ANTLR4 jar to create the HelloParser.h, HelloParser.cpp, etc files. I have downloaded the runtime (antlr4-cpp-runtime-4.7.1-vs2015) as well. But what am I supposed to do with these files in order to include them in my main solution/project? Let's say my solution is in C:\Users\UserName\source\repos\test.

C++ copy formatted code to word (like Visual assist's)

I've browsed but could not find an answer..
I'm trying to copy code from my editor to look like the VA coloring, but it only copies like the VS coloring..
(Another great option would be to somehow do it like StackOverflow formats, but I could not find how to do that as well)
I've found:
http://www.wholetomato.com/products/features/rtf.asp
But it does not show where it is, nor can I find it (VS 2010)..
Does anyone know how to do it?
Or does anyone has an idea on how to copy formatted code to word?
Thanks!
A quote from the page you linked to:
Microsoft Visual Studio
Copying HTML to the clipboard is a built-in feature of Microsoft Visual
Studio and Visual Assist X does not enhance the feature. The
clipboard contains only the default colors of the IDE. Enhanced syntax
colors are not placed in the clipboard.
So it seems like what you want cannot be done.
If your ultimate goal is to make a final pdf, you can convert text file to pdf and combine your code pdf to your word pdf. You can try notepad++ for your default coloring your code.
Sorry but,
Microsoft Visual Studio
Copying HTML to the clipboard is a built-in feature of Microsoft Visual Studio and Visual
Assist X does not enhance the feature. The clipboard contains only the default colors of
the IDE. Enhanced syntax colors are not placed in the clipboard.
The feature you've meant was available only at Visual C++ 6.0.
VC++ 6.0 has no embedded ability to copy formatted code so they made their own realization of this feature in their plugin.
If you want just have VAssistX colored pdf you can try to print document in Visual Studio using any pdf printer such as PDFCreator then you can import it in Word (at least in LibreOffice Writer).

How visual studio intellisense recognize functions and properties in classes even though there is no reflection in C++?

I want to list properties and functions present in c++ classes. Is that functionality already implemented in any library ? Does visual studio intellisense use any library ? Is that library available publicly from Microsoft?
Visual Studio parses your code, so that's how it knows. You would need to do the same.
The Visual C++ team maintains a blog that has had several very nice articles about how IntelliSense has worked in the past and how it will work in the future:
IntelliSense History, Part 1
IntelliSense, Part 2 (The Future)
Visual C++ Code Model
Rebuilding Intellisense
Visual C++ Code Model in Visual Studio 2010
Essentially they build their own 'reflection' database (the .ncb file in current and past version sof VS, using a compact SQL database starting with VS2010) by parsing the headers and other source files - using both custom parsers and parsing that's done with the cooperation of the compiler.
Apparently at least some of that information is available in the VCCodeModel and related interfaces that the Visual Studio extensibility model provides. I have no idea how well the extensibility model works or how easy it is to use.
They use a propriety format to store intellisense information (they are saved as NCB files). You can delete these files to force VS to recreate its intellisense database if things go wrong.
They then scan header files for class information as well as dependencies, then build the NCB file for future reference.
No, this library is not available for personal use.
Intellisense in C# is lots better than the one in C++
VS2010 will see C++ have the same intellisense features as C# currently enjoys.
I would imagine that Visual Studio uses the header files to provide Intellisense.