IVsContainedLanguageHost::GetLineIndent Method (Int32, String^, Int32, Int32, Int32, Int32)
Provides information on the base indent level and indent settings.
Assembly: Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)
int GetLineIndent( int lLineNumber, [OutAttribute] String^% pbstrIndentString, [OutAttribute] int% plParentIndentLevel, [OutAttribute] int% plIndentSize, [OutAttribute] int% pfTabs, [OutAttribute] int% plTabSize )
Parameters
- lLineNumber
-
Type:
System::Int32
[in] The line number for the line of text in question. This is the line number in the secondary buffer (that is, it is typically relative to the first line of code).
- pbstrIndentString
-
Type:
System::String^
[out] Returns the exact indent string. This string is to be inserted at the beginning of each line that is reformatted and represents the base level of indentation. See Remarks for more information.
- plParentIndentLevel
-
Type:
System::Int32
[out] Returns the indent level in spaces. This value should be ignored if the pbstrIndentString parameter returns a non-empty string.
- plIndentSize
-
Type:
System::Int32
[out] Size of the indent.
- pfTabs
-
Type:
System::Int32
[out] Returns nonzero (TRUE) if tabs are to be used for line indents; otherwise, returns zero (FALSE), use spaces instead.
- plTabSize
-
Type:
System::Int32
[out] Size of the tab indent, if present. If the pfTabs parameter returns zero (FALSE), this value is unspecified.
From singlefileeditor.idl:
HRESULT GetLineIndent( [in] long lLineNumber, [out] BSTR* pbstrIndentString, [out] long* plParentIndentLevel, [out] long* plIndentSize, [out] BOOL* pfTabs, [out] long* plTabSize );
This method is called by a contained language performing any kind of reformatting where the indent level must be known. The base indent level is the indent level of the containing (parent) block:
<html>
<script language="vb" runat="server">
Sub TestSub()
Dim x as String
End Sub
</script>
</html>
In this example, the base indent is the indent of the <script> tag, which is two spaces here.
If the editor decides to derive the indent from the source itself, the pbstrIndentString parameter provides the exact indent string (in the above example, this would a string containing two spaces) then the plParentIndentLevel parameter has no meaning and should be ignored. If the editor is not able to derive the indent from the source, the editor returns a null string in the pbstrIndentString parameter. In that case, the contained language should use the value in the plParentIndentLevel parameter.