用于代码对齐的Visual Studio扩展 [英] Visual Studio Extension for Code Alignment

查看:218
本文介绍了用于代码对齐的Visual Studio扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何免费扩展程序执行代码匹配,例如 将作业与生产力电动工具对齐 ,但要对齐此代码:

Is there any free extension to perform code alignment, like Align Assignments with Productivity Power Tools but to align this code:

public int ID;
public string Title;
public string Text;
public decimal Factor;

这样吗?

public int      ID;
public string   Title;
public string   Text;
public decimal  Factor;


推荐答案

正如Pop Catalin所说,代码对齐是你的后面。这是我的扩展,抱歉没有多少文档。

As Pop Catalin said, Code alignment is what you're after. It's my extension, sorry for not much documentation. It's something that's so much easier to explain with videos, but I'm still to get around to it.

当你通过字符串对齐时,它会找到字符串的第一个实例并将它们排列起来。例如,如果您输入'=',则

When you align by string it finds the first instance of the string and lines them up. For example if you were to enter '=' then

foo = bar;
foobar = foo;

会成为

foo    = bar;
foobar = foo;

但是,您的代码没有公共分隔符 - 除了它之前的空格。所以你可以使用Align By Space(从工具栏或ctrl + =,ctrl +空格,但你必须删除已经分配给ctrl + =)。 Align By Space使用您的插入符位置(您仍然可以选择要对齐的行,或让扩展名指出它),并在插入位置后面的每一行的第一个空格对齐。

However, your code doesn't have a common delimiter - except for the space before it. So you can use Align By Space (from the toolbar or ctrl + =, ctrl + space, but you'll have to remove what's already assigned to ctrl + =). Align By Space uses your caret location (you can still select the row you want to align, or let the extension figure it out) and aligns by the first space on each line after your caret location.

希望有意义!

这篇关于用于代码对齐的Visual Studio扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆