visual-studio - how to use customize visual studio window title




Add Custom Tag to Visual Studio Validation (3)

How can I add rules to Visual Studio (2005 and up) for validating property markup (HTML) for a vendor's proprietary controls?

My client uses a control which requires several properties to be set as tags in the aspx file which generates something like 215 validation errors on each build. It's not preventing me from building, but real errors are getting lost in the noise.


Right-click on the Source view of an HTML / ASP page and select "Formatting and Validation".

  1. Click "Tag Specific Options".
  2. Expand "Client HTML Tags" and select the heading.
  3. Click "New Tag...".
  4. And just fill it in!

I wish that I could add custom CSS values as well.


This may not be the best solution but here is what I came up with.

Use macros to capture Key Press Events.

Here's how:

  1. In Visual Studio go to the Tools->Macros->Macros IDE menu
  2. Double Click "MyMacros" to see the different parts
  3. Double Click "EnvironmentEvents"
  4. Add the following code within the Environment Events module.
  5. Save the file and return to the regular VS IDE to test.

    Private My_AutoCaps As Boolean = False
    Private Sub TextDocumentKeyPressEvents_BeforeKeyPress(ByVal Keypress _
      As String, ByVal Selection As EnvDTE.TextSelection, _
      ByVal InStatementCompletion As Boolean, ByRef CancelKeyPress As Boolean) _
      Handles TextDocumentKeyPressEvents.BeforeKeyPress
         Dim fileName As String = UCase(Selection.DTE.ActiveDocument.Name)
         If ( fileName.EndsWith(".CPI") ) Then
             If (My_AutoCaps) Then
                 'MsgBox(Keypress)
                 If (Keypress = "(" Or Keypress = ":") Then
                     'MsgBox("End of command character pressed.")
                     My_AutoCaps = False
                     Return
                 ElseIf (Keypress >= "a" And Keypress <= "z") Then
                     'MsgBox("Letter pressed.")
                     Selection.Text = UCase(Keypress)
                     CancelKeyPress = True
                 End If
             Else 'AutoCap is not on yet
                 If (Keypress = "^") Then
                     'MsgBox("You pressed the Start Command character.")
                     My_AutoCaps = True
                     Return
                 End If
             End If
         End If
    End Sub
    

This macro is limited to *.CPI files.

I have not figured out how to capture the Esc key yet but this will work for now.


Programatically enforce capitalization in Visual Studio 2008?

Try out StyleCop, available from Microsoft's web site. You might have to adjust the rule-set for your specific coding standards. For the coding standards we use, it was almost perfect out of the box.







visual-studio