Re: C# Variable Declaration Spec

Davy J <[email protected]> Mon, 23 Apr 2007 09:59:03 +0200
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <[email protected]>
This should help, it's a 2005 macro, can't remember if you can do the
same thing in 2003.

Dave,

   Private Function GetCodeElement(Optional ByVal findInnerBrace As
Boolean = False, Optional ByVal ClassOnly As Boolean = False) As
CodeElement

        Dim sel As TextSelection = DTE.ActiveWindow.Selection
        If findInnerBrace Then
            sel.FindText("{")   'find the next open bracket
        End If

        Dim code As CodeElement
        If ClassOnly Then
            Return sel.ActivePoint.CodeElement(vsCMElement.vsCMElementClass)
        End If

        code = sel.ActivePoint.CodeElement(vsCMElement.vsCMElementFunction)
        If code Is Nothing Then
            code = sel.ActivePoint.CodeElement(vsCMElement.vsCMElementAttribute)
        End If
        If code Is Nothing Then
            code = sel.ActivePoint.CodeElement(vsCMElement.vsCMElementProperty)
        End If
        If code Is Nothing Then
            code = sel.ActivePoint.CodeElement(vsCMElement.vsCMElementClass)
        End If
        Return code
    End Function

On 4/22/07, Brady Kelly <[email protected]> wrote:
>  My first step is to extract the variable names from the
> text block,

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com