共用方式為


ViewFilter.HandleSmartIndent Method

Handles smart indentation.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)

Syntax

'宣告
Public Overridable Function HandleSmartIndent As Boolean
public virtual bool HandleSmartIndent()

Return Value

Type: System.Boolean
Returns true if the caret position has changed as a result of smart indentation. Returns false if no changes have been made to the source.

Remarks

This method handles the task of reformatting a section of code in response to the Enter key. This could be as simple as moving the caret to the next line, taking into account the current indent level or as complex as fixing the indent level for the contents of a matching triplet (for example, "if", "{", and "}") when the Enter key is pressed after the closing element.

The base method does nothing and returns false.

In the default managed package framework's implementation of the language service classes, this method is called from the HandlePreExec method in response to the RETURN command but only if the IndentStyle property is set to Smart.

.NET Framework Security

See Also

Reference

ViewFilter Class

Microsoft.VisualStudio.Package Namespace