Udostępnij za pośrednictwem


IParseSink::QualifyName Method

Returns the location of each member selector and associated qualified name within a given span of text.

HRESULT QualifyName ( 
   long lineSelector,
   long startIdxSelector,
   long endIdxSelector,
   long line,
   long startIdx,
   long endIdx
);

Parameters

  • lineSelector
    [in] Specifies the line containing the member selector, for example, "." or "->".

  • startIdxSelector
    [in] Specifies the starting index in the line of the member selector.

  • endIdxSelector
    [in] Specifies the ending index in the line of the member selector.

  • line
    [in] Specifies the line containing the qualified name associated with the member selector.

  • startIdx
    [in] Specifies the starting index in the line of the first character in the qualified name.

  • endIdx
    [in] Specifies the ending index in the line of the last character in the qualified name.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

Call this method only if your IBabelService::ParseSource Method implementation is called with any of the following ParseReason Enumeration values in the reason parameter:

  • ReasonMemberSelect

  • ReasonCompleteWord

  • ReasonQuickInfo

  • ReasonMethodTip

  • ReasonAutos

You should call IParseSink::QualifyName for each selector that is found in the span of text passed to you in the text parameter of IBabelService::ParseSource Method. For example, in the case of x = Form.height, call the following methods (in the order the specified tokens are parsed):

  • StartName ("x")

  • StartName ("Form")

  • QualifyName (".","height")

The Default Babel Implementation in the Language Service Package, this method is called from the StdService::qualifyName method that in turn can be called from within your grammar file. The Example in this topic shows how the qualifyName method is called when a member select character is parsed.

For a more detailed discussion on using the StdService::qualifyName method, see How to: Add Member Completion.

Example

This is a fragment from the default parser.y grammar file that is created using the Visual Studio Language Service Wizard. This fragment shows how identifiers and identifiers with member select are interpreted and the qualifyName method is called on the language service (g_service). The qualifyName method eventually calls the IParseSink::QualifyName method.

Identifier
    : IDENTIFIER                 { g_service->startName($1); }
    | Identifier '.' IDENTIFIER  { g_service->qualifyName( $2, $3 ); }    
    | Identifier '.' error       { g_service->qualifyName( $2, $2 ); }
    ;

See Also

Tasks

How to: Add Member Completion

Reference

IParseSink Interface

IParseSink::StartName Method