code-formatting

Code Wrap IntelliJ?

蹲街弑〆低调 提交于 2019-11-29 20:54:28
How would be possible to assign a shortcut for word wrap like as sublime text do? i.e. if the code line is too long it should be automatically break to the next line. wikipedia.org.org/Word_wrap I think "soft wrap" might be what you're after. It's read-only, i.e. does not change the characters in the file, it only wraps what you see on screen. Intellij >= 14.1.4 : As pointed out by looper in the comments, the options are under File > Settings > Editor > General - under the Virtual Space or Soft Wraps sub-group. Intellij < 14.1.4 : Look under File > Settings > Editor > Virtual Space . It doesn

How to have the formatter wrap code with IntelliJ?

假如想象 提交于 2019-11-29 19:03:58
I'm not able to format my code in IntelliJ. I can see the margin line (by default at 120 columns) but it seems that the activation from the menu: Code -> Reformat Code is just ignoring this margin. Péter Török Do you mean that the formatter does not break long lines? Check Settings / Project Settings / Code Style / Wrapping. Update: in later versions of IntelliJ, the option is under Settings / Editor / Code Style. And select Wrap when typing reaches right margin . IntelliJ IDEA 14, 15, 2016 & 2017 Format existing code Ensure right margin is not exceeded File > Settings > Editor > Code Style >

How to blog code at wordpress.com [closed]

给你一囗甜甜゛ 提交于 2019-11-29 18:51:18
got a new blog at wordpress few days ago ( http://ghads.wordpress.com ) and I want to post some code snippets now or then. Is there anyway to make it look like code without paying for extra plugins? Alex Duggleby See here: http://en.support.wordpress.com/code/posting-source-code/ Wrap your code in these tags: [sourcecode language='css'] .. [/sourcecode] (or shorter [code lang='css'] .. [/code] ) Note that Visual Editor doesn't interpret the tags, you need to click Preview to see how it works. Available language codes: actionscript3 bash clojure coldfusion cpp csharp css delphi erlang fsharp

How can I indent multiple lines in Xcode?

ぐ巨炮叔叔 提交于 2019-11-29 18:33:00
When I select multiple lines of code and want to indent them as usual with TAB key, it just deletes them all. I come from Eclipse where I always did it that way. How's that done in Xcode? I hope not line by line ;) JWD The keyboard shortcuts are ⌘ + ] for indent and ⌘ + [ for un-indent. In Xcode's preferences window, click the Key Bindings toolbar button. The Key Bindings section is where you customize keyboard shortcuts. JavierGiovannini Select your code to reindent, then Go to Editor -> Structure -> Re-Indent Nik ⌘ + [ and ⌘ + ] are the equivalents to shift+tab in Xcode. swiftBoy Here are

JavaScript formatting: must braces be on the same line as the if/function/etc keyword? [duplicate]

我的未来我决定 提交于 2019-11-29 15:13:36
Possible Duplicate: why results varies upon placement of curly braces in javascript code We have company policies that dictate that in PHP opening curly braces should be on their own lines for readability and so that they can line-up with the closing brace; thus: if (true) { ... } but in JS they should be kept on the same line, in case there are problems with browsers incorrectly interpretting it . if (true) { ... Is the above italic part a legitimate concern? PS - I suspect that this question has been asked on here already, but I've not found a question that exactly matches mine. Apologies if

Are there any free cmd-line scripts which can re-format PHP source-code?

别来无恙 提交于 2019-11-29 15:09:53
I'm using a pre-commit hook to lint-check PHP source submitted by our staff, and everyone's really happy with the results. The staff have agreed it would be useful to have the code re-formatted to follow (customizable) style rules on commit. Are there any FOSS scripts which can do this from the command-line? Was looking for the same thing, just came across the PHP Beautfier package in the PEAR repository: http://pear.php.net/package/PHP_Beautifier Hope this helps! PHP_CodeSniffer is a nice PEAR package, but it only sniffs the PHP documents for detecting violations of coding standards - it

How can I apply a new Emacs C style to reformat all my source files?

半腔热情 提交于 2019-11-29 14:23:24
问题 I'd like to re-format all my source files using the Google formatting function for emacs: google-c-style.el (see here). How can I apply this function to all my source files at once, so that they are all formatted and indented correctly according to the Google style? 回答1: There are several pieces to this: you need to come up with EMACS functions to do all the reformatting you want. indent-region is a start, but you might also want to untabify or some other things. you need to invoke them on

Formating javascript source code [closed]

自作多情 提交于 2019-11-29 13:04:20
There is js file with a lot of code in unreadable format (all code in one line): JS file Is there a tool to format to a "normal" view? The developer tools, integrated in most modern browsers, are capable of cleaning up the formatting. As an example, below is an animated GIF showing how you can achieve this in Microsoft Edge: Similar functionality exists for both Chrome , and Firefox as well. There are also online solutions if you want to copy/paste a large block of minified code. Brian Agnew's link should work fine. There's also the standalone Polystyle which I can recommend (costs $15 though)

AnkhSVN client side pre-commit hook

点点圈 提交于 2019-11-29 11:48:59
Basically I want to do the same thing as the fella over there . It seems that everybody was thinking about server-side hooks (with all their evil potential). I want a client side script be run before commit so astyle can format the code the way my boss likes to see it. Since my IDE (VS2010Pro) automatically checks when a file changed on the disk an opts me in for reloading it, there is no real evil with all that. Is there any (clean) way to accomplish that with AnkhSVN? Maybe there's also a way to extend VisualStudio to call my pre-commit-script... It seems like AnkhSVN is being made to use

Spring - adding BindingResult to newly created model attribute

一世执手 提交于 2019-11-29 11:23:42
问题 My task is - to create a model attribute by given request parameters, to validate it (in same method) and to give it whole to the View. I was given this example code: @Controller class PromotionController { @RequestMapping("promo") public String showPromotion(@RequestParam String someRequestParam, Model model) { //Create the model attribute by request parameters Promotion promotion = Promotions.get(someRequestParam); //Add the attribute to the model model.addAttribute("promotion", promotion);