In Visual Studio (2015) is it possible to change the color/font of lines within comments as viewed in the Text Editor using a custom token or indicator? IE a manner that is similar to that of how Task List items can be assigned and are recognized by user-custom tokenization.
For example:
/* --- Explanatory Comment ---
<> This token is recognized, and the rest of this line appears in orange color.
<1> As a result of the token, this line now appears in a different font.
+ Additional information about the above; the text is light grey.
<?> This line appears in bold (and indicatively curious) blue text.
<!> Extra points, pending the possibility of the aforementioned that the
remainder of the text in line with first character of this paragraph
also conforms to the style as defined by the token preceding it.
*/
MSDN documentation seems to indicate that the creation of "Custom
Categories and Display Items" can be achieved (With the addition of
a VSPackage?) such that they would appear within the display options
box of the fonts and colors under environment in the IDE's options
menu (Options>Environment>Fonts and Colors).
Or by some way of the "IVsFontAndColorDefaultsProvider Interface".
Is there some known and/or preexisting manner in which to accomplish the previously described rendering or a preferable alternative (similar) solution? If the above is the solution, any insight as to its implementation would be greatly appreciated. Thanks in advance.
*Note: My intent is visual enhancement within my own VS Text Editor (potentially others with a package) for the purpose of clarity in such a case that hierarchical organization in comments would be beneficial; rendering to supplement ASCII characters alone.
MSDN Docs:
Implementing Custom Categories and Display Items
IVsFontAndColorDefaultsProvider Interface
Related
The documentation on each display item in Visual Studio's Environment options for Fonts and Colors is lacking. There is a documentation page on msdn, but even this is incomplete (not all display items are listed), and contains limited descriptions. This makes it difficult for those that like to customize their code editor styling to understand which items they need to manipulate. The lack of a search function also further complicates things.
The main question which would answer this question is, is there more extended documentation on this available somewhere?
Since I highly doubt this (at least my search efforts have failed me thus far), I suggest to start bundling more elaborate documentation where needed (complicated display items) posted as answers to this question. It is encouraged to add screenshots so the visible impact is instantly visible.
There is no documentation available for Highlighted Definition, Highlighted Reference, and Highlighted Written Reference. These all pertain to highlighting similar items within source code to the item currently selected.
Highlighted Definition: Specifies the highlight color for where the currently selected item is defined (e.g., member definition, type definition, constructor, ...).
Highlighted Reference: Specifies the highlight color for where the currently selected item is referenced.
Highlighted Written Reference: Specifies the highlight color for where the currently selected item is assigned a new value.
In the example below:
Red is a Highlighted Definition
Blue is a Highlighted Reference
Green is a Highlighted Written Reference
There is a code snippet to set automatic color in visual studio in VB:
Dim fci As FontsAndColorsItems = DTE.Properties("FontsAndColors", "TextEditor").Item("FontsAndColorsItems").Object
fci.Item("VA Find Reference").Foreground = &h01000000 ' Automatic
fci.Item("VA Find Reference (Modified)").Foreground = &h01000000 ' Automatic
In VS 2013, I use the Selenitic color scheme. When importing it in VS 2015, I see some differences.
VS 2013:
VS 2015:
There are some differences (interface color, XML comment color), the thing that annoys me the most is that the XML comments in 2013 are nicely colored and in 2015 it is all the same color. I also noticed that xml comments are using a different color. I like the syntax highlighting in 2013, the XML comments are more subtle there. Is there a way I can fix this?
I found that some names of the elements in a .vssetting file have been changed. So, you need to rename them to the new ones to import it correctly. Here's the list of changed names which I found so far.
Old Name -> New Name
---------------------------------------------------------------------------------------------
Brace Matching (Rectangle) -> brace matching
String(C# # Verbatim) -> string - verbatim
User Types -> class name
User Types(Enums) -> enum name
User Types(Interfaces) -> interface name
User Types(Delegates) -> delegate name
User Types(Value types) -> struct name
Line Numbers -> Line Number
Razor Code -> RazorCode
XML Doc Comment -> xml doc comment - text
XML Doc Tag -> xml doc comment - delimiter
xml doc comment - name
MarkerFormatDefinition/HighlightedReference -> MarkerFormatDefinition/HighlightedReference
MarkerFormatDefinition/HighlightedDefinition
I believe this is not all, but at least it includes the missing colors you showed.
This doesn't specifically fix the import of a scheme, but the XML comment colors (in VS2015) can be manually changed
Assuming the following comment block
/// <summary>
/// Description
/// </summary>
/// <param name="test">Value</test>
/// <returns>Result</returns>
Go to Tools / Environment / Fonts and Colors:
There are a section of options all starting with "XML Doc Comments - ". Change each of these to change the corresponding part of the comment.
Delimiter: /// < < /
Name: summary, param, returns
Attribute Quotes: "
Attribute Name: name
Text: Description, Value, Result
I cannot find an option to independently color "test" above - it appears to be linked with "Identifier".
I'm pretty annoyed with the color changes. So far, I've found that Visual Studio 2015 has these differences:
Added new items (Display items) in the list
Split a single item into multiple items, some with a different color than before
User Types. Enums, Interfaces, and Type Parameters have a more pale green. Old color: rgb(78,201,176)
Changed default colors for some items
All comments were made a brighter green. Old color: rgb(96,139,78)
(Note that there are 8 different items relating to comments: Comment, CSS Comment, HTML Comment, VB XML Literals - Comment, VBScript Comment, XAML Comment, XML Comment, and XML Doc Comments - Comment.)
Identifiers (e.g. JavaScript code) made dimmer. Old color: white
HTML Entities changed to some blue-ish color. Old color: silver
more...
Note that the colors listed are defaults for the "Dark" theme, with the "old colors" being listed from Visual Studio 2012. The differences above are the most noticeable differences that I saw, since I wanted to change the JS color and the comment colors. There are probably others I haven't noticed yet.
If you need more help, this answer was also somewhat helpful for me.
Simple solution: avoid VS all together for theme management.
I agree with #Brandon on this. Backward incompatibility for font settings is insane for Microsoft and, unfortunately, a poor first impression for many of us when we upgrade to a new VS version. Just don't use VS for theme management (yes, it should just work, but after all Microsoft is focused on delivering more innovative features than making our IDE's look pretty).
Luke Sampson at Studio Styles (https://studiostyl.es/) does an amazing job keeping look & feel consistent while dealing with all the annoying label changes and other mappings that beak cross version setting export/import. Takes some time for the initial set up but after that you can export the version you need. Best part, it works...
Is there a way to bold text in Intellisense comments?
My idea:
/// <summary>
/// <para><bold>Paramater1:</bold>: blah blah
...
I've been looking at how to do this, and haven't found any way. And it's very aggravating.
There are essentially two kinds of intellisense: 1) the info that pops up as you're typing something out (shows overloads and everything) and 2) the tooltip that pops up when you hover over something that's already written out.
I haven't found anything that can affect #2. (And I suppose that isn't strictly intellisense anyway, just a tooltip comment. Though, it does show the same info...)
But for #1 there are a couple things you can do to highlight words and stuff.
The first is using <see cref="SomeActualCodeElementHere" /> which will make whatever you put in the quotes to show as bold (I thought they also used to be clickable and would take you to the definition of that code element, but I can't figure out how to make that work in VS2013).
The second is using <c>AnythingCanGoHere</c> which makes whatever you put in there to show as a different color (blue?). Handy for like <c>true</c> and <c>false</c> and stuff.
Note that when using cref the code element has to be able to be resolved in the current context, or it won't highlight the text. Using <c> however, will highlight/color any text.
One last thing, if you use your documentation externally, or are producing code to be consumed by other developers and are generating xml comment files, then the <b> tag is said to work for some tools. (In Visual Studio when you have a browse reference to an assembly that has an xml comment file with it, VS still behaves as described above, unfortunately.)
Extremely late answer, but Google brought me here, so hopefully this can help either you or someone else out.
You can use "Better Comments" visual studio plugin.
This tool allows you to customize your comments as follows:
Use '!' for Important.
Use '?' for Question.
Use "Todo" (Case ignored) for Task.
Use 'x', 'X', or double comment for strikethrough (Crossed).
You can find more options in the link.
I would like to show a vertical line, next to the linenumbers, in my visual studio 2010 between parentheses when my courser is between those 2 parantheses.
I alread had that option enabled, but somehow its gone.
edit: is nobody using that feature? one of the very nice things when you are debugging
Is no one using that feature??
Edit: so last push!! there must be a way to see where the space between parentheses starts and ends.
edit: here is an image
EDIT: I still haven't found what i'm looking for. VS is so powerful there must somewhere an option or a plugin. It is really useful when you can see where your { begins and ends }.
Anyone a clue?
I haven't seen the horizontal line feature since 2008. I hated it so I haven't been looking for it either.
You should however be able to see the braces being highlighted when your cursor is on them. If not, perhaps you've changed your theme or possibly some colors in your Options menu.
Here's what you should try:
Tools ->
Options(down at the bottom of the drop-down) ->
Environment ->
Fonts and Colors
Make sure the Show settings for: selector is showing Text Editor.
The one(s) you're looking for are Brace Matching (Highlight/Rectangle).
Attempt to change it to your choosing and see if the changes take place. If not, reset to the defaults and re-check it's enabled.
Also...
Another suggestion that can be handy to get a temporary look at the extents of the body you can hover your mouse just along the margin it will highlight the most nested body. You may have to do some tweaking of your colors to make it vibrant. I use a darker color and have my code block highlighting white. I know it's not what you're looking for but it might be somewhat of a band aid.
I am developing an extension to add graphics around code (text).
I've searched around and came up with only one other post refering to IWpfTextView (and related) interfaces.
What i want is to "markup" the code with (ex) arrows, boxes and lines. I've read through the mdsn and it seems scrolling up and down does a complete redraw and the Top coordinate changes.
There's also http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.text.editor.aspx
But no complete text on the matter.
Are there any examples on the subject? Is this a supported scenario?
Yes, this is supported.
In the SDK, there is a project template for "Text Relative Adornment", which shows the general idea. That template places an adornment underneath text, like a highlight, but you can place text-relative adornments anywhere on the view ("text-relative" just means that the adornment scrolls with the text).
For examples, you can start with this AgentBadgeVisualManager.cs file, which is for displaying a user "badge" off to the right of a piece of text.
I recently wrote a blog article about text relative adornments, though it's more of "best practices" and less of "here is the code you need to put an arrow on the editor".