Narrange 将 Header 置于 using 语句下方
我刚刚下载了 NArrange (v0.2.9) 并运行了它。我注意到它将 using 语句移到了我不想要的命名空间声明内。
我创建了 DefaultConfig.xml 的副本,然后使用 NArrange 配置编辑器更改了格式 ->使用指令-> “移动到”元素到“文件”而不是“命名空间”的默认值。
运行该工具时(我没有忘记指定 /c 选项,提供新的 config.xml 文件的路径),它确实将 using 语句放置在名称空间声明之外,但它也将它们放置在标头上方!不是我想要的。
请注意,文档中标题为“图:标题区域和使用指令排序”的图表示header 位于 using 语句之上。
(我试图标记这个“NArrange”,但该标签不存在,而且我的代表数少于 1500,我必须选择一个,所以我选择了 Visual-studio-2008)
I just downloaded NArrange (v0.2.9) and ran it. I noticed it moved the using statements inside the namespace declaration which I didn't want.
I created a copy of DefaultConfig.xml and then, using the NArrange Configuration Editor I changed the Formatting-> Using directives-> "Move To" element to "File" instead of the default value of "Namespace".
Upon running the tool (I did not forget to specify the /c option, providing the path to my new config.xml file) it does place the using statements outside the namespace declaration, however it also places them above the header! Not what I want.
Note that the figure in the documentation titled "Figure: Header Region and Sorted Using Directives" indicates the header being above the using statements.
(I tried to tag this "NArrange" but the tag doesn't exist and I have less than 1500 rep, and I had to pick one so I went with visual-studio-2008)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够通过使用“移动到 - 命名空间”选项排列文件,然后将使用指令设置更改为“移动到 - 文件”并重新排列,来重现您所看到的问题。但是,我注意到的一件事是,如果在更改设置然后进行排列后,如果您将标题移回到代码文件的顶部,则在下一次 NArrange 运行时它将保留在文件的顶部。
基本上,将 using 语句从命名空间级别移动到文件级别时似乎存在问题。
您能否确认,如果使用“移动到 - 文件”设置将标题移动到文件顶部,它会保留您期望的行为?
I was able to reproduce the problem you were seeing by arranging a file with the "Move To - Namespace" option then changing the Using Directives setting to "Move To - File" and re-arranging. However, one thing I noticed is that if after changing the setting then arranging, if you then move the header back to to top of your code file, it will stay at the top of the file with the next NArrange run.
Basically, it seems that there is an issue when moving using statements from the namespace level to the file level.
Could you confirm that if move your header to the top of the file with the "Move To - File" setting that it preserves the behavior you were expecting?