Share via


IScope::GetDeclarations Method

Returns a list of declarations (statement completion information) in a scope given a specific context.

HRESULT GetDeclarations ( 
   long line,
   long idx,
   INames* names,
   IDeclarations** decls
);

Parameters

  • line
    [in] Specifies the line for which to determine the declarations (that is, the line containing the cursor).

  • idx
    [in] Specifies an index position within the line for which to determine the declarations. The line index is zero-based and refers to the position of the cursor within the line.

  • names
    [in] Specifies a qualified name (a list of name and selector pairs). For more information, see INames Interface.

  • decls
    [out] Returns the declarations object. For more information, see IDeclarations Interface.

Return Value

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

Remarks

This method returns the declarations in a scope given the following context:

  • A line, as defined in the line parameter.

  • An index in the line, as defined in the idx parameter.

  • A qualified name, as defined in the names parameter.

Declarations are used by Babel to provide statement completion information to the environment. If the namesparameter contains Stack.X, then all members of Stack should be returned. Babel automatically calls the IDeclarations::GetBestMatch Method with X as its argument to select the members that have X as their prefix. If the location is unknown, then the line and idx parameters are both zero. If the namesparameter is NULL or empty, then return all visible declarations specified in the line and idx parameters.

This method is typically called in response to the IntelliSense Complete Word option or a TriggerClass Enumeration value of TriggerMemberSelect. The default Babel implementation handles this call for you in these cases.

See Also

Reference

IScope Interface

IDeclarations Interface

IDeclarations::GetBestMatch Method