예제 #1
0
 public override string Goto(VSConstants.VSStd97CmdID cmd, IVsTextView textView,
                             int line, int col, out TextSpan span)
 {
     if (_lines != null && (cmd == VSConstants.VSStd97CmdID.GotoDefn ||
                            cmd == VSConstants.VSStd97CmdID.GotoDecl))
     {
         // Parse for any identifier that may be at the cursor.  If the is one,
         // find the variable or function definition for that identifier and jump
         // to it.
         bool   isVariable = false;
         string identifier = CMakeParsing.ParseForIdentifier(_lines, line, col,
                                                             out isVariable);
         if (identifier != null)
         {
             if (isVariable)
             {
                 if (CMakeParsing.ParseForVariableDefinition(_lines, identifier,
                                                             out span))
                 {
                     span.iEndIndex++;
                     return(_fileName);
                 }
             }
             else
             {
                 if (CMakeParsing.ParseForFunctionDefinition(_lines, identifier,
                                                             out span))
                 {
                     span.iEndIndex++;
                     return(_fileName);
                 }
             }
         }
     }
     span = new TextSpan();
     return(null);
 }