0

我确实为 VS 使用了模板工具。我用过 JustCode 和 ReSharper。但我发现我经常可以使用更动态的东西。

这是一个简单的例子:

给定班级

class Dog
{
    public string Name { get; set; }
    public int NumLegs { get; set; }
    public DateTime Birthdate { get; set; }
}

我想将其转换为:

class Dog
{
    public string Name { get; set; }
    public int NumLegs { get; set; }
    public DateTime Birthdate { get; set; }

    public Dog CloneMe()
    {
        return new Dog
        {
            Name = this.Name,
            NumLegs = this.NumLegs,
            Birthdate = this.Birthdate,
        };
    }
}

过去我只是在 Vim 中打开文件,然后就完成了。我还编写了 ruby​​ 脚本来转换文件。

两者都有点麻烦。关于为做这样的事情而设计的工具有什么建议吗?

4

2 回答 2

0

你试过 VsVim 吗?它是 Visual Studio 的插件,可将编辑器转换为 vim 编辑器。 http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329

于 2014-04-11T12:03:11.657 回答
0

Visual Studio 具有内置的“脚本”引擎。例如,您可以在编辑器中使用 (DTE.ActiveWindow.Selection as EnvDTE.TextSelection).ActivePoint.CodeElement[vsCMElement.vsCMElementClass] 作为 EnvDTE.CodeClass 找到所选类的属性,然后您可以写入当前编辑点带有 DTE.ActiveDocument.Selection 的 VS 编辑器。

于 2014-04-11T14:35:55.857 回答