c# - Visual Studio 扩展:更改编辑器选项卡名称
问题描述
我尝试使用扩展名更改 Visual Studio 2017 中编辑器选项卡的标题。来自 DTE2 并使用 getter ActiveWindow 我可以阅读标题,但如果我更改它,则会发生“System.InvalidOperationException”异常。
var dte = Package.GetGlobalService(typeof(DTE)) as DTE2;
var currentWindows = dte.Windows;
foreach (Window window in dte.Windows)
{
if (window.Caption.EndsWith("cs"))
window.Caption = "foo";
}
实现 IWpfTextViewCreationListener 我可以获得已打开文件的创建 IWpfTextView,但我无法在那里找到标题。
internal sealed class ViewportAdornment1TextViewCreationListener : IWpfTextViewCreationListener
{
public void TextViewCreated(IWpfTextView textView)
{
// Own implementation
new ViewportAdornment1(textView);
}
}
任何人都可以给我一个起点,我可以在哪里继续?
解决方案
推荐阅读
- azure - 在 AKS 群集下的 devspaces 中运行应用程序时出现问题
- amazon-web-services - 我可以使用 aws 中的 ssl 而不是让地址(ip)本身加密吗?
- perl - 我们可以使用不带前缀的 perl 包变量,只在该包中使用范围吗?
- php - Copy and paste values from 2 differents db with a button
- pm2 - 如何使用 pm2 启动带有 AutoReload 的strapi?
- python - 将 numpy memmap 保存到新文件并从该文件加载新的 memmap 会导致值更改
- python - 如何在 Google App Engine 中设置 Kafka 客户端
- android - 带有导航组件的 DialogFragment(方向问题)
- python - 将scrapy与Cherrypy一起使用?
- scala - 在 RDD 操作中避免对象变量?