code highlighting - visual-studio

I want code highlighting like visual studio.
If user is attaching a code snippept in the article i want to hightlight the code exactly like what visual studio will do.
How can we achieve this.

For example google-code-pretify. If you are not talking about code that is contained in a website but e.g. in a desktop application, you should clarify your question.

http://www.actiprosoftware.com/Products/DotNet/ASPNET/CodeHighlighter/default.aspx
Does this tool do what you want?

If you're in PHP you can also use FSHL: http://code.google.com/p/fshl/. Examples are included.

Related

Is there a view/widget to show details of language elements in Visual Studio?

In Eclipse, there is a view called "ABAP Element Info", which can show details about language elements such as functions, classes, etc. when they are clicked on. It will display details such as function/method signature, class/struct members, element documentation, etc. as you can see on the image below:
It is a great help for me and it's very quick to find out details of elements, but I cannot find anything like it in Visual Studio standard package (except Object Browser, but I does not show what I click on, I need to look it up). Is there any extension or something with similar functionality I could make use of? I'm using C++ desktop version if it helps. Thanks a lot for any input.
Instead of using Visual Studio, try to check if your project is fully supported and operational in Visual Studio Code.
In VSCode there are various plugins for ABAP development, including syntax highlighting which is your main concern.
Check out the following article on how to prepare your environment:
https://blogs.sap.com/2019/12/06/abap-development-in-vs-code/

Visual Studio Extension -How to color code?

I am writing Visual Studio Extension Color code. My code is mix of 2 languages. Only one language is colored , so I want to color the second language and I don't know how. Is there something that allows me color code on the way I want.
I want something like this
code example
Which part of code provides me to color code?
You're looking to provide what's called a "classifier". Here's one example:
https://www.codeproject.com/Articles/1245021/Extending-Visual-Studio-to-Provide-a-Colorful-Lang
In general the interface to look for is "IClassifierProvider".
In case you are talking about Visual Studio Code:
You will have to create your own extension. To do so you can follow this guide right here. More specifically you should run this command:
npm install -g yo generator-code
And once the installation is over you run:
yo code
You should the choose New Language support and answer all the questions that will appear. Once it's done you can start defining your language. To do so you should go to the syntaxes directory and start editing the <plugin_name>.tmLanguage.json.
In this file you will normally find code examples. Here is the example of an existing Python extension.
If you pay attention there is sometimes a variable called name of this style "comment.line.number-sign.python". In order to find the possible values for this variable, I would suggest you to take a look here. The choice of this name will define the color of the matching value.
I hope this was helpful to you.

Snippet Designer/Editor for Visual Studio 2010

What Editors/Designers for creating Visual Studio 2010 Snippets are there?
I would like to be able to put in different replacements (ie spots where the text should be replaced). A low incidence of blocking bugs is also nice.
So far the only one I have seen is Snippet Editor 2.1. I am going to dig into it and see how it works, but I did not want to spend too much time on that app if there is a better one out there.
I like Snippet Designer by Matt Manela and chose to use it in my Extending Visual Studio course. I like the Snippet Explorer and searching snippets as well as the designer view to help you edit them, including replacements. It also gives you a nice Export as Snippet context menu item. And the code is on CodePlex if you would like to learn how it's done.
Go to the Visual Studio Gallery and search for "snippet" in the "Find" box. You should find several options (e.g. Snippet Designer, Snipper, etc.). I haven't used any of these so I can't attest to how good they may be but at least it's a start.
Hope this helps.
Resharper (not free) has it's own snippet system which is really great. I'm adding this answer because I was searching for something not realising I already had something installed (Resharper)

A way to "improve" write coding in vs2008 experience

I would like to try to automize some recurrent job when i develop asp.net application.
For example, for each <asp:button> I create, I would like to insert the classical code
onomouseover="...something"
onmouseout=" ..something-again.."
Is there a way to automatically add this code "piece" in vs 2008?
Some key combination to add "pre-ready" piece of code?
Thank you
Try using code snippets. This article explains.

BlogEngine.Net Code Formatting Extension that works?

For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the TinyMCE editor. Does anyone know of an extension that works, or a different approach that will allow me to make code samples pretty on my blog without hacking the crap out of the HTML myself?
Thanks.
I would try using Windows Live Writer along w/ the Paste From Visual Studio plugin. One you go WLW, you'll never go back to that damn TinyMCE interface.
WLW here:
http://get.live.com/writer/overview
Plugin here:
http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&l=8
Thanks, Rafe. Thanks to this post that Hanselman put up the day after I asked the question, I downloaded WLW and am now using it. As far as getting prettily formatted code, I'm using cut-and-paste from a little tool developed and available on manoli.net.
Check out SyntaxHighlighter.. Works excellent. For easy integration into BlogEngine have a look at my blog post.

Resources