处理 FORMATSELECTION 命令重新设置选择。
命名空间: Microsoft.VisualStudio.Package
程序集: Microsoft.VisualStudio.Package.LanguageService(在 Microsoft.VisualStudio.Package.LanguageService.dll 中)
Microsoft.VisualStudio.Package.LanguageService.10.0(在 Microsoft.VisualStudio.Package.LanguageService.10.0.dll 中)
Microsoft.VisualStudio.Package.LanguageService.9.0(在 Microsoft.VisualStudio.Package.LanguageService.9.0.dll 中)
Microsoft.VisualStudio.Package.LanguageService.11.0(在 Microsoft.VisualStudio.Package.LanguageService.11.0.dll 中)
语法
声明
Public Overridable Sub ReformatSelection
public virtual void ReformatSelection()
备注
该基方法确定重新设置是否支持,调用 GetSelection 方法获取当前选定文本的 TextSpan (默认为整个文档,如果没有选定任何内容),创建新的 EditArray 对象包装所做的任何更改。唯一上取消事件,然后对从在 ViewFilter 类构造函数的 CodeWindowManager 对象中获取的 Source 对象的 ReformatSpan 方法。最后,该基方法调用 EditArray 对象的 ApplyEdits 方法进行任何更改。
通常,可以复盖 Source 类的 ReformatSpan 方法支持重新设置文档的各个部分。因为该基方法设置了所有调用于 ReformatSpan 方法,但通常不需要重写此方法,除非 ReformatSpan 的版本有特殊要求。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。