本文介绍了C ++格式如Visual Studio C#格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢的方式的Visual Studio(2008)格式的C#代码;不幸的是它似乎编写C ++时代码不会以同样的方式表现。



例如,当我写这样一个代码:

 类测试{
公众:
INT X;
。测试(){这 - &X的催化剂= 20;}
〜测试(){}
};

在C#(好吧,这是C ++,但你可以明白我的意思),这一部分:

  $ p> 

将变为:

 测试(){这个 - > X = 20; } 

这显然是一个愚蠢的例子,但也有很多的东西的地方在正确的位置上放支架,缩进代码和其他的东西与我自己的手变得乏味。



我可以明显改变编辑器,如果你建议我一个很好的一个C ++代码,我想找到的东西具有以下功能:




  • 智能感知(如VS,至少是相似的)

  • 自定义类着色(在C = C#它们是青色,为什么他们黑C ++?)

  • 自动换行(可能)

  • 文档时,在一个方法,你的鼠标/变量

  • 自动格式化(当您关闭就像一个括号}在C#中,你会得到
    每件事情做好格式化)



显然,我可以找到其他的功能,但是这是在我心中的时刻。



感谢您的任何建议。


解决方案

我使用VS2012的astyle延伸和我很高兴。结果
它是免费的:)


I like the way Visual Studio (2008) formats C# code; unfortunately it seems it doesn't behave in the same way when writing C++ code.

For example, when I write a code in this way:

class Test {
public:
    int x;
    Test() {this->x=20;}
    ~Test(){}
};

in C# (ok this is C++ but you can understand what I mean), this part:

Test() {this->x=20;}

Will become:

Test() { this->x=20; }

This is obviously a stupid example, but there are a lot of things where putting brackets in correct position, indenting code and other things with my own hands becomes boring.

I can obviously change editor if you suggest me a good one for C++ code, I would like to find something with these features:

  • Intellisense (like vs, at least similar)
  • Custom class coloring (in C=C# they are cyan, why are they black in C++?)
  • Wordwrap (possibly)
  • Documentation when you mouse over a method/variable
  • Auto formatting (when you close a bracket like "}" in C# you'll geteverything well formatted)

Obviously I can find other features, but this is what is in my mind at the moment.

Thanks for any suggestion.

解决方案

I'm using AStyle extension for VS2012 and I'm happy with it.
It's free :)

这篇关于C ++格式如Visual Studio C#格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 09:20