Partager via


ViewFilter.CanReformat Method

Determines whether the source can be reformatted by the language service.

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

Syntax

'Declaration
Public Overridable Function CanReformat As Boolean
public virtual bool CanReformat()
public:
virtual bool CanReformat()
abstract CanReformat : unit -> bool  
override CanReformat : unit -> bool
public function CanReformat() : boolean

Return Value

Type: Boolean
true if the source can be reformatted, otherwise false: either the debugger is active or the language service does not support reformatting.

Remarks

A reformat can occur if the user explicitly selects Format Selection of Format Document, or it can occur implicitly as the result of entering a character that triggers an auto-format action (for example, entering a "}" could cause all of the text between the "}" and the opening "{" to be indented properly).

The base method determines if a debugger is active (returning false if it is active) and if not, returns the value from the EnableFormatSelection property.

.NET Framework Security

See Also

Reference

ViewFilter Class

Microsoft.VisualStudio.Package Namespace