code-formatting

Emacs Ruby method parameter indentation

ⅰ亾dé卋堺 提交于 2019-12-04 09:56:06
问题 I want to make emacs indent ruby method calls like: foo( :blah => 'bar', :shibby => 'baz' ) The closest I can get is: foo( :blah => 'bar', :shibby => 'baz' ) This is using ruby-deep-indent-paren, ruby-deep-indent-paren-style, ruby-deep-arglist all set to nil. Hashes indent how I like... if I could just make method calls indent like hashes I would be happy. Any ideas? 回答1: Dmitry Gutov has posted this fix, using advice, which seems to work: (defadvice ruby-indent-line (after unindent-closing

ReSharper Line Breaks and Wrapping

我只是一个虾纸丫 提交于 2019-12-04 08:13:29
问题 So, this: cmd = new OdbcCommand( string.Format( @" SELECT * FROM Bobby_Tables WHERE Name = {0}", "Little Bobby Drop Tables" ), odbcConnection ); gets formatted to: cmd = new OdbcCommand( string.Format( @" SELECT * FROM Bobby_Tables WHERE Name = {0}", "Little Bobby Drop Tables" ), odbcConnection ); I've looked at each of the options for line breaks and wrapping but I haven't been able to find the one to keep things on the same line as long as possible. I'm assuming that I missed the correct

How Do I Avoid Line-Break Padding?

半世苍凉 提交于 2019-12-04 04:37:07
My biggest gripe with HTML is that line breaks add a tiny bit of space between elements. ( jsFiddle .) This can screw up layouts where child elements are sized to exactly fit their parents. I read somewhere that you can remove this implicit padding - while still keeping the code somewhat legible - by using comments like this: <!-- --><div>Foo</div><!-- --><div>Bar</div><!-- --><div>And so on...</div><!-- --> This works, but I feel like there has to be a better solution. What other ways are there to work around the line-break padding? That isn't "a little bit of space", but literally a space

How do I use code contracts in .NET 4.0 without making my code look cluttered?

只愿长相守 提交于 2019-12-04 03:45:21
I have started using Code Contracts and have found that it makes it difficult to immediately spot the 'guts' of a method. Take this (very simple) example: public static void UserAddNew(string domain, string username, string displayName) { Contract.Assert(!string.IsNullOrWhiteSpace(domain)); Contract.Assert(!string.IsNullOrWhiteSpace(username)); Contract.Assert(!string.IsNullOrWhiteSpace(displayName)); LinqDal.User.UserAddNew(domain, username, displayName); } Now I'm tempted to put the contracts in a region, so that they can be hidden away, but then I'm concerned that I'm losing a nice

JSF Code formatter or Eclipse XML Editor, each tag for new line?

穿精又带淫゛_ 提交于 2019-12-04 03:21:46
How to format JSF code in eclipse? I already try as the following : Format XML code in Eclipse My XML Editor Configuration Setting is : Line width 120 Split multiple attributes each on a new like Checked Align final bracket in mulit-line element tags Checked Clear all blank lines Checked If I do Ctrl + Shif + F , eclipse format the code as below. <tr> <td><h:outputText value="#{label['MANAGE_USER_TITLE']}" styleClass="table-title" /></td> </tr> My expectation format is, after Ctrl + Shif + F <tr> <td> <h:outputText value="#{label['MANAGE_USER_TITLE']}" styleClass="table-title" /> ▲ This line

How to align XML code in Android Studio?

时光怂恿深爱的人放手 提交于 2019-12-04 01:43:02
问题 is there any feature in Android Studio to align all XML attributes by '=' sign. I am unable to find any setting that would allow this. Just another code format fanatic who likes code readability. 回答1: below code will align everything but not after = sign. for better answer here Win/Linux: Ctrl + Alt + L Mac: Option + Command + L 回答2: Try like this Settings - Editor - XML 来源: https://stackoverflow.com/questions/28245890/how-to-align-xml-code-in-android-studio

Will excessive commenting of code slow execution? [duplicate]

限于喜欢 提交于 2019-12-04 00:30:23
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Do comments slow down an interpreted language? Will there be noticeable performance degradation in the execution of a large .py file if more than 75% of the lines of code are properly commented? 回答1: No When you run python, the first step is to convert to bytecode, which is what those .pyc files are. Comments are removed from these, so it won't matter * . If you run with the -O or -OO option, python will produce

How to set Python language specific tab spacing in Visual Studio Code?

一世执手 提交于 2019-12-03 22:05:44
Using VSCode 1.9.0 with the (donjayamanne) Python 0.5.8 extension, is it possible to provide Python specific editor options? Or more generally speaking, is it possible to provide language specific tab spacing and replacement rules? For example, Python should be tab=4 spaces (replaced as spaces), and Ruby should be tab=2 spaces (replaced). Other languages tend to have their own opinions. However, I only see the general "editor.tabSize": 4, "editor.insertSpaces": true, options. I thought perhaps there was a "python.editor": { } block or perhaps a "python.editor.tabSize" option, but I can't find

Code polisher / reformater for C, C++ or Fortran [closed]

*爱你&永不变心* 提交于 2019-12-03 19:40:42
问题 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 4 years ago . Suppose you have got a bunch of files written in C, C++ or Fortran, by different authors, with different opinions on formatting, how to comment, and so on. I think many people know situations like these. Are there any free tools for ends like: uniform format of code (indent, etc.) create standard comment bodies

Declaring a looooong single line string in C#

那年仲夏 提交于 2019-12-03 14:28:11
问题 Is there a decent way to declare a long single line string in C#, such that it isn't impossible to declare and/or view the string in an editor? The options I'm aware of are: 1: Let it run. This is bad because because your string trails way off to the right of the screen, making a developer reading the message have to annoying scroll and read. string s = "this is my really long string. this is my really long string. this is my really long string. this is my really long string. this is my