Programmatically provide capitalization in Visual Studio 2008?

What is the easiest way to programmatically force keywords in Visual Studio 2008?

We work with a corporate language with command delimiters (for example, HTML). We are trying to move from an older editor to Visual Studio 2008. Our coding standards are for using commands. The old editor is configured to recognize the separator of the beginning of the command and force capitalization until the final separator is printed or the evacuation key is pressed.

What is the best way to do this in Visual Studio 2008? Can this be done with a macro or add-in?

(Edited 1-12-2009)

Thanks for the suggestions so far. I do not think they answer my question.

Explanations:

  • The previous editor was CodeWright, so the settings there are not portable to the visual studio.
  • The source code is not C #. StyleCop seems to be specifically for C #. Our language is similar to markup languages ​​such as HTML, but with different delimiters and commands.
  • I'm trying to actually capitalize as types of developers, and not remind them of the right capitalization. Since all commands are limited, our current editor actually turns on Caps Lock when the initial delimiter is entered. When the end separator or evacuation key is pressed, the cap lock is disabled. It does not depend on the state of the caps lock on the keyboard.
+3
source share
3 answers

, .

.

:

  • Visual Studio - > - > IDE
  • "MyMacros", .
  • "EnvironmentEvents"
  • " ".
  • VS IDE .

    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
    

*.CPI.

, Esc, .

+1

StyleCop, - Microsoft. , . , , .

+4

, this, SO , VS2005. , 2008 .

Visual Studio, .

+1

All Articles