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

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).

Related

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.

How to apply format when saving in Visual Studio 2022?

I have placed a .clang-format file in my project and can apply the formatting with Ctrl+K, Ctrl+D. I have also configured and enabled "Run Code Cleanup profile on Save" under Options -> Text Editor -> Code Cleanup. But when I save a file, the formatting is not applied.
Is there something I'm missing?
Thank you in advance!
Edit: Since it does not seem to be possible for C++ (as of June 2022), I will be using the extension Format on Save for VS2022 for now, which has a bit more functionality compared to Sedenion's suggestion.
You can use the free "Format document on Save" extension (github) to format C++ code via clang-format in Visual Studio 2022 on saving.
Side note, in case anyone else is reading this: In Visual Studio 2017 and 2019 you can also use the Microsoft extension "Power Commands for Visual Studio" for this purpose.
Unfortunately, Code Cleanup only applies to C# and VB.Net, and not to C++ code.
From MS documentation
For C# code, you can also configure Visual Studio to apply these code style preferences using the Code Cleanup

How to import Visual Assist snippets to Visual Studio 2017?

I have downloaded the latest Visual Studio Community and InteliSense seems to work well even without the Visual Assist plugin, save a few bugs. I'd therefore like to continue working without the plugin.
I had plenty of code snippets in Visual Assist. How can I migrate them to visual studio 2017 without Visual Assist?
I can get you started:
Visual Studio expects XML:
https://learn.microsoft.com/en-us/visualstudio/ide/walkthrough-creating-a-code-snippet
Visual Assist stores its snippets in a legacy, non-XML format. Fortunately, you can "export" XML using the VA Snippet Editor. Open the editor; multi-select in the list; copy; paste into an external editor.
If the snippets you want to export share words in their descriptions or follow a pattern, you can simplify the multi-select by limiting what appears in the list. Change the Type dropdown to "Search", then search a field by string or regex.
I don't have a convenient way to convert from one XML format to the other.

Attaching Documentation in Visual Studio (à la Eclipse)

I'm new to Visual Studio (2012) and having come from using Eclipse, I'm finding myself missing the ability to hover my mouse over a method and receive a dialogue detailing the parameters and any accompanying comments.
In this particular example, I'm using the OpenGL SDK with C++ in Visual Studio, and I would like to be able to quickly get at the documentation without having to jump between VS and http://www.opengl.org/sdk/docs/man/.
Is there a way that I can attach the documentation somehow so that I can view it from within Visual Studio itself without needing to manually search?
visual studio does provide the functionality you are looking for as a tooltip (instead of a dialogue) when you hover long enough (2-3 seconds). For this to work correctly and more usefully though, you'd need the functions to be documented properly in the code itself.
Check the following questions for more information on how intellisense tooltip works :
How to get full intellisense tooltip comments working?
Documenting C++/CLI library code for use from c# - best tools and practices?
By default though, intellisense will simply display the comment above the function declaration or deninition (which ever comment is larger, it seems). It takes a while longer when you hover first time over a function, so be patient and retry :)
you can type in the code 3 slash /// and visual studio automaticalli write a xml template for the documentation of the method/class/property.
next you can go in the project properties. Build tab, Output section, XML documentation file, and enter the filename. It will be built on every build of the project.
You could try NDOC or SandCastle if you dont mind using 3rd party tools.

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

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