办法让VS 2008停止强迫压痕的命名空间? [英] Way to get VS 2008 to stop forcing indentation on namespaces?

查看:121
本文介绍了办法让VS 2008停止强迫压痕的命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从来没有真正去过的方式大多数编辑器手柄命名空间的大风扇。他们总是强迫你加入缩进一个额外的意义的水平。

I've never really been a big fan of the way most editors handle namespaces. They always force you to add an extra pointless level of indentation.

比如说,我有一个页面大量的代码,我宁愿喜欢采用

For instance, I have a lot of code in a page that I would much rather prefer formatted as

namespace mycode{

class myclass{
  void function(){
    foo();
  }
  void foo(){
    bar();
  }
  void bar(){
    //code..
  }

}

}

而不是像

namespace mycode{

  class myclass{
    void function(){
      foo();
    }
    void foo(){
      bar();
    }
    void bar(){
      //code..
    }

  }

}

老实说,我真的不喜欢,甚至类的东西被缩进大部分的时间,因为我通常只有1班每个文件。它看起来并不那么糟糕这里,但是当你得到一吨的代码和大量的作用域,就可以轻松拥有缩进,迫使你关闭屏幕,再加上这里我只用2 - 空间标签,而不是4空间正如我们所使用。

Honestly, I don't really even like the class thing being indented most of the time because I usually only have 1 class per file. And it doesn't look as bad here, but when you get a ton of code and lot of scopes, you can easily have indentation that forces you off the screen, and plus here I just used 2-space tabs and not 4-space as is used by us.

总之,有没有办法让Visual Studio中停止试图缩进命名空间对我这样?

推荐答案

这是一个黑客,但这里有云:

It's a hack, but here goes:

namespace mycode{ 
#if 0
}
#endif

class myclass{
    ...

这篇关于办法让VS 2008停止强迫压痕的命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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