Automatically adding specified text at beginning of files in VS 2008 - visual-studio

Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.

I assume you'd like to modify the class file templates. They're in:
%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
More specific details here

I found a better solution than modifying the template file directly. This utility allows you to create and save header/footer templates and apply them to entire source trees.
C# Header Designer from MSDN Code Gallery

Related

Where is the documentation on Visual Studio's decorators?

Note: This is not for Visual Studio Code, but for the full version of Visual Studio.
When developing extensions for Visual Studio Code, there is something called Decorators, which can add icons next to each line of code.
I'd like to do the same, but for Visual Studio instead. However, I can't find anything by the name "Decorators" in the documentation. Is it even called that within the full Visual Studio?
Can anyone point me in the right direction?
More specifically, I am interested in making an extension that can produce the icons seen here, and I am unsure what these icons are called in the scope of Visual Studio:
Vertical part where icons are shown is called "glyph margin" and icons in it are called "margin glyphs". Provided link will lead you to a MSDN walkthrough to create your own glyph for a line that has a "todo" text in a comment.
I found a sample that describes it pretty well:
https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/Todo_Classification

Is there a way to extract comments from code files with DTE (Visual Studio Automation)?

I want to extract comments from code files in a Visual Studio extension. Is there a way to do it using Visual Studio Automation without having to parse code text myself?
PS: Roslyn is not a choice, because I'm not restricted to C# and VB.NET only.
Various code elements like CodeClass and CodeFunction have the Comment property that return the header comment, accessible using Visual Studio code model.
And if a document is opened in VS editor, you can check SnapshotSpan classifications for PredefinedClassificationTypeNames.Comment.

Visual studio data-bind attribute highlighting [knockout.js]

In previous versions of Visual Studio I've had knockout.js syntax highlighting.
Since moving to Visual Studio 2017 Community building in Razor however, the syntax highlighting is gone and I found no way to enable it.
Interesting is however, that when I put the very same code into project built on Webforms, the highlighting seems to work at least to some degree
Is there anything I can do to enable syntax hightlighting for Razor? And/Or is there a way how to make custom syntax highlighting rules? [e.g. highlight specific data attribute, or so]
Try this. Also Read the overview.
https://marketplace.visualstudio.com/items?itemName=ms-madsk.RazorLanguageServices
Yes, in our Project we added the file reference on the _references.js file:
/// <reference path="knockout-3.4.0.debug.js" />
This make Visual Studio Intellisense to get the sintax hightlighting on the .cshtml files.
Reference Directives
A reference directive enables Visual Studio to establish a relationship between the script you are currently editing and other scripts. The reference directive lets you include a script file in the scripting context of the current script file. This enables IntelliSense to reference externally defined functions, types, and fields as you code.
Sources:
MSDN - JavaScript IntelliSense
C# Corner - Use of _references.js File
Mads Kristensen - The history behind _references.js

Custom syntax highlighting in Visual Studio 2010 in a html file

Is it possible to create syntax highlighting for custom defined words in known file type?
For example I want to have VS text editor color the tags <# and #> a specified color when viewed in a html file.
Can you do this, and if so then how is it possible?
Yes, well, certainly this is possible for C++ files and files that Visual Studio recognises; so if VS is set up to recognise your HTML as C++ files you should be good.
You will need to create a usertype.dat file and place it in your
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
folder (or equivalent for VS2010, this is for VS2008)
This file should have the keywords you want listed separately on each line;
for example; I develop with Qt and I have a usertype.dat file as:
signal
slots
Q_OBJECT
(and so on)
Restart VS and your keywords will be highlighted.
I got the info from here and verified it on my system.

How to keep several files in a tree in Visual Studio?

When you add (for example) WPF window to your project VS creates .xaml and .xaml.cs files. However they are not displayed in a flat list in VS Explorer, rather .xaml.cs is a child file (in terms of the tree) of .xaml file.
How to organize several "custom" files into such tree? For example I have Trainer.cs file and Trainer.Builder.cs file. I would like Builder to be displayed as a child of Trainer.cs file. How to do it?
Please note: I know about folder with files, but I don't want to use it, because in such case even the "main" file is hidden and I have to unfold folder to get it.
Update
While searching for difference between VS2008 and VS2010, I found out, that my entire question is a duplicate of SO question -- there you find how to fix a fix for VS2008 to work with VS2010 :-)
Visual Studio 2010 related file nesting
This can be done by editing the registry. A guide to doing this for Visual Studio 2008 can be found here: http://blog.dotnetwise.com/2009/09/visual-studio-2008-custom-nested-files.html
You can also do this through a Visual Studio Extension, but unless this is part of a larger project this is probably overkill. There is a guide to implementing this behavior here: http://pieterderycke.wordpress.com/2011/03/10/adding-support-for-nested-files-in-custom-visual-studio-project-types-with-mpf/

Resources