code-formatting

Is there any tool for reformatting C# code? [closed]

不打扰是莪最后的温柔 提交于 2019-12-08 15:29:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am looking for a (preferably) command-line tool that can reformat the C# source code on a directory tree. Ideally, I should be able to customize the formatting. Bonus points if the tool can be run on mono (or linux). 回答1: A bit late coming across this... You could also try NArrange to reformat your code. The

Is there a text editor that will “pretty print” for display without changing the underlying text?

依然范特西╮ 提交于 2019-12-08 14:16:27
There are two competing requirements 1) I want to pretty print so that I can read and understand code written by my peers 2) I don't want to check in the pretty printed code to source control because... It might not meet the coding standard where I work When reviewing history in source control, formatting changes obscure the 'real' changes. For discussion of problems checking in formatting changes, see this other stackoverflow question Committing when changing source formatting? At the same time, I still need to be able to edit the file and save changes. I want to be able to edit the ugly text

Eclipse 3.6 (Helios) formatter messing up XML comments?

雨燕双飞 提交于 2019-12-08 06:49:30
问题 Our project has hundreds of comments within XML files. Some of these are just dividers like this: <!-- ============================================================================================== Entity Manager Bean ============================================================================================== --> We use the XML autoformatter extensively and it always kept lines seperated, while at the same time word wrapping other lengthy comments. Now in Helios, we get this: <!--==========

(Re)formatting PHP code in Vim

萝らか妹 提交于 2019-12-08 06:42:36
问题 How do I format PHP code that looks like this class SomeClass { function insideclass() { } } into this, using Vim without any external tool? class SomeClass { function insideclass() { } } I am not arguing that this is the best way to format the code, but this is what we are following in the team. Edit : Removed reference to the snippet addon, which caused some confusion about the question. 回答1: You have two unrelated problems and you won't find a unique solution to both. You don't like the

Eclipse 3.6 (Helios) formatter messing up XML comments?

最后都变了- 提交于 2019-12-07 22:59:29
Our project has hundreds of comments within XML files. Some of these are just dividers like this: <!-- ============================================================================================== Entity Manager Bean ============================================================================================== --> We use the XML autoformatter extensively and it always kept lines seperated, while at the same time word wrapping other lengthy comments. Now in Helios, we get this: <!--============================================================================================== Entity Manager

How to configure eclipse to keep this code format?

我是研究僧i 提交于 2019-12-07 22:55:07
问题 Following code is from a sample of playframework-2.0: /** * Display the dashboard. */ public static Result index() { return ok( dashboard.render( Project.findInvolving(request().username()), Task.findTodoInvolving(request().username()), User.find.byId(request().username()) ) ); } It looks good, but when I use code format of eclipse, it becomes: /** * Display the dashboard. */ public static Result index() { return ok(dashboard.render( Project.findInvolving(request().username()), Task

How to force code style formatting as part of the build?

怎甘沉沦 提交于 2019-12-07 08:36:59
问题 Is there a way (using ANT), it is possible to automatically reformat code to follow certain conventions? I have several developers working on a program and would like to guarantee that code formatting becomes consistent across all classes at build time, prior to commit 回答1: The best way to do it pre-commit is to use a pre-commit hook on your source control server. This way you can enforce that no code makes it into the branch without conforming to code standards. http://checkstyle.sourceforge

When can I use newlines (line breaks) in my Powershell commands to improve readability

醉酒当歌 提交于 2019-12-06 12:55:59
How do I know when I can use a New Lines/Carriage returns in my Powershell scripts? All of the search results when searching for this answer all point to the Output. I don't care about the output in this case. I am more interested in my ability to format my Powershell scripts for readability. For Example. Two versions of a Powershell command line below. One works and one doesn't. What the command does in unimportant in this case. The point is I am needing to know when I'm allowed to create a new line and when I am not. This command line Works as it's just one long single line: & 'C:\Program

How to configure eclipse to keep this code format?

我是研究僧i 提交于 2019-12-06 12:42:20
Following code is from a sample of playframework-2.0: /** * Display the dashboard. */ public static Result index() { return ok( dashboard.render( Project.findInvolving(request().username()), Task.findTodoInvolving(request().username()), User.find.byId(request().username()) ) ); } It looks good, but when I use code format of eclipse, it becomes: /** * Display the dashboard. */ public static Result index() { return ok(dashboard.render( Project.findInvolving(request().username()), Task.findTodoInvolving(request().username()), User.find.byId(request().username()) )); } How to configure eclipse to

Can the Eclipse code style formatter align assignment statements?

蓝咒 提交于 2019-12-06 12:12:12
Eclipse has an option in Indentation: "Alignment of fields in class declarations" that will align assignments of class members as in: class Foo { int x = 3; String y = "abc" long z = 2; } Is there a setting that will do the same for method level assignments as in: private void foo() { int x = 3; String y = "abc" long z = 2; } I can not find such a setting. Try creating a new Java Code Style Formatter profile (Window->Prefernces->Java->Code Style->Formatter) or modifying an older one and check Indentation and Braces tabs. Agath For future visitors. There is no such option in Eclipse, but, as