code-formatting

Stop Eclipse from mangling my comments

天大地大妈咪最大 提交于 2019-11-29 05:32:18
问题 Is there a way to stop eclipse from mangling the comments in my source files? My main issue is stopping it from word wrapping them. I've managed to configure eclipse to not word wrap any code but it still seems to do it to comments. Code that I enter like this: public int myVariable = 100; // this variable is a very interesting variable and it does lots of stuff End up like this: public int myVariable = 100; // this variable // is a very // interesting // variable and // it does lots // of

Ruby indented multiline strings [duplicate]

梦想与她 提交于 2019-11-29 03:56:32
This question already has an answer here: How do I remove leading whitespace chars from Ruby HEREDOC? 11 answers It's a best-practice question. There are obvious ways to do that, none of them just seem quite right. Quite often I need to test that some multi-line string gets produced. This normally breaks indentation making everything look like a mess: class TestHelloWorld < Test::Unit::TestCase def test_hello assert_equal <<EOS, hello_world Hello, world! World greets you EOS end end With <<- I can indent here doc marker, but it doesn't strip indentation inside heredoc, it still looks horrible.

How do I configure autoformatting in Eclipse?

筅森魡賤 提交于 2019-11-29 03:33:40
I dislike how auto format messes up empty cycle body, like: Before for (int i = 0; isTest(i); i++); After for (int i = 0; isTest(i); i++) ; How to configure eclipse not to do this? tddmonkey Go to Windows -> Preferences , and in the options table select Java -> Code Style -> Formatter , then configure to your hearts content. For future reference, in the Preferences menu you can just type in a search term to find all options for that term - so just going onto the Preferences menu and typing "format" will show you all options 来源: https://stackoverflow.com/questions/1392744/how-do-i-configure

editing the NetBeans source formatting standard

一世执手 提交于 2019-11-29 03:04:34
Is there any way of changing the standard by which NetBeans automatically formats the code when doing "Source->Format"? I seem to remember seeing this option somewhere, but I can't find anything about it. You can change a very limited number of settings related to formatting. open up netbeans IDE Go to tools->options click on Editor button on top left of the options dialog box click on the formatting tab select PHP from the language select box then you would be able to see the required settings that can be changed. Latest version 7.3 will solve most of your needs. The formatting preferences

Windows batch command to ignore case sensitivity in variables

不问归期 提交于 2019-11-29 02:47:24
I have a set of variables I allow some people I work with to edit. These are True ( T ) and False ( F ) values, but I have some people that insist on putting t and f instead of the upper case values respectively. I use the following workaround code to properly set uppercase values: IF '%dotnet35%'=='f' set dotnet35=F IF '%dotnet35%'=='t' set dotnet35=T IF '%dotnet40%'=='f' set dotnet40=F IF '%dotnet40%'=='t' set dotnet40=T IF '%regedit%'=='f' set regedit=F IF '%regedit%'=='t' set regedit=T IF '%SSL%'=='f' set SSL=F IF '%SSL%'=='t' set SSL=T This is however extremely bulky and it's not easy on

How to beautify Javascript and CSS in Firefox / Firebug?

巧了我就是萌 提交于 2019-11-29 02:10:38
问题 Is there a way to beautify javascript and css in Firebug? I'd like to be able to view formatted js instead of the compressed version :). 回答1: CSS is already beautified in Firebug, as clearly seen by comparing the CSS tab or CSS pane with the raw source. JavaScript, alas, is not. The best you can do, for now, is to paste the code into something like http://jsbeautifier.org/ . However, if you write a Firebug extension that does this, you will have all of our gratitude. ;-) 回答2: there is now a

Turn off Eclipse formatter for selected code area? [duplicate]

ε祈祈猫儿з 提交于 2019-11-29 01:12:45
This question already has an answer here: How to turn off the Eclipse code formatter for certain sections of Java code? 12 answers When I ctrl + shift + f up the project code, its doing its job just fine, everywhere. But its messing the CSS, specially those filter parts and adding bunch of spaces. Also how do I specify some portion of Java code to not be formated by that command ? To prevent specific portions of Java code from being formatted, go to "Window > Preferences > Java > Code Style > Formatter". Click the "Edit..." button, go to the "Off/On Tags" tab and enable the tags. Afterwards,

Custom indent width for BeautifulSoup .prettify()

依然范特西╮ 提交于 2019-11-29 01:05:13
Is there any way to define custom indent width for .prettify() function? From what I can get from it's source - def prettify(self, encoding=None, formatter="minimal"): if encoding is None: return self.decode(True, formatter=formatter) else: return self.encode(encoding, True, formatter=formatter) There is no way to specify indent width. I think it's because of this line in the decode_contents() function - s.append(" " * (indent_level - 1)) Which has a fixed length of 1 space! (WHY!!) I tried specifying indent_level=4 , that just results in this - <section> <article> <h1> </h1> <p> </p> <

how to align arguments to functions in emacs?

馋奶兔 提交于 2019-11-29 01:00:29
问题 Say if I have the following: func(arg1, arg2, arg3...) func(longargarg1, longerarg2, arg3,...) ... How do I align the arguments so that it's like following? func(arg1 , arg2 , arg3...) func(longargarg1, longerarg2, arg3,...) ... [I can use M-x align-regex to align the first argument, but I cannot cook up with a suitable regex to align the rest of the arguments. Bonus point if the answer also take cares of the case when some arguments are strings with commas in them.] 回答1: Select the region,

Smart Indent algorithm documentation?

让人想犯罪 __ 提交于 2019-11-28 22:56:24
问题 I'm a big fan of documenting the proper behavior of IDE features that have a subtle but significant impact on coding flow - things like auto-completion selection and commenting/uncommenting code you might not realize you take advantage of but at the end of the day you got just a bit more done than you might have. I do so in hopes that other language services I have to use incorporate the feature(s), subsequently improving my daily coding life. "Real" Smart Indent, i.e. the Visual Studio 2008