code-formatting

Formatting Field Declarations in Eclipse

别来无恙 提交于 2019-12-10 16:57:33
问题 Greetings Overflowers, Problem (names of variables are aligned by not their types): public abstract class Filter { private long id; protected String expression; } how can I align fields automatically in Eclipse, such in: public abstract class Filter { private long id; protected String expression; } Note the space before long , thank you ! UPDATE: I cannot find a customization option to align types of class members (e.g.: long and String ) under Eclipse formatter options. Yes, there is one to

Beautify / Format Java code in Visual Studio Code

佐手、 提交于 2019-12-10 14:57:25
问题 I have tried some proposals on here and here, but none of them works. How do you accomplish it for Java code or is there a way for general? En passant, I've install XML formatter in order that it may work, but not. 回答1: For proper formatting, you need to install a VSCode extension that provides Java formatting. Try this one from Redhat: https://marketplace.visualstudio.com/items?itemName=redhat.java After the extension is installed, that standard code format commands / shotcuts should work

Multi-language command-line source code formatter [closed]

跟風遠走 提交于 2019-12-10 12:32:43
问题 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 . Is there a command-line Unix tool that will format/indent/prettify source code in different languages? I'm especially interested in Java, JavaScript, PHP, and XML, but ideally it would handle others. (I'm not looking for something to generate syntax-highlighting markup; I already know of a few tools that do that

Is the Open Source Jalopy Eclipse plugin compatible with Ganymede?

拥有回忆 提交于 2019-12-10 10:00:38
问题 After much searching, I found the download for the eclipse version of jalopy. Is this compatible with Eclipse 3.4? It's dated 2006. I've copied the extracted folder to my plugins directory and run eclipse -clean , but I can't find anything matching 'jalopy' in preferences. If it's not compatible, are there any (free) alternatives? 回答1: Just an update: Note: the latest eclipse3.5 Galileo code formatter now: supports most of Jalopy formatting option. has made quite a few improvement on

Intellij adding extra line in new blocks

非 Y 不嫁゛ 提交于 2019-12-10 04:08:07
问题 When I'm writing code in Intellij, I often create new blocks by typing these types of sequences: if (test) { Typing that open curly brace causes Intellij to automatically insert a closing brace and move the cursor between the two braces: if (test) {|} At this point, I simply press Enter and get a nicely formatted block with the cursor right where it should be: if (test) { | } However, today Intellij is adding an extra line to the block, like this: if (test) { | } I've looked all over the

How to prettify HTML so tag attributes will remain in one single line?

半腔热情 提交于 2019-12-10 02:45:15
问题 I got this little piece of code: text = """<html><head></head><body> <h1 style=" text-align: center; ">Main site</h1> <div> <p style=" color: blue; text-align: center; ">text1 </p> <p style=" color: blueviolet; text-align: center; ">text2 </p> </div> <div> <p style="text-align:center"> <img src="./foo/test.jpg" alt="Testing static images" style=" "> </p> </div> </body></html> """ import sys import re import bs4 def prettify(soup, indent_width=4): r = re.compile(r'^(\s*)', re.MULTILINE) return

Committing when changing source formatting?

∥☆過路亽.° 提交于 2019-12-10 00:51:57
问题 Is it accepted practice to commit even when you're just changing things like whitespace, code formatting, etc.? 回答1: Yes. If you need to do whitespace changes, doing them in a separate commit that contains only this kind of cleanup is the best practice. This avoids problems with trying to see what part of a giant diff is actual code changes, and what part is just formatting (cosmetic) changes. That said, you should try to keep these kind of changes to a minimum, and only do it at all when it

PHP HTML Formatter Beautifier [closed]

回眸只為那壹抹淺笑 提交于 2019-12-09 23:11:17
问题 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 5 years ago . I am looking for a software which can beautify both PHP and HTML code. Dreamweaver seems to do a good job with html but not PHP PHP designer does a good job with PHP but messes up HTML. Any suggestions guys ? 回答1: Eclipse with setted up by you formatting rules. Both HTML and PHP formatter. And it's free. 回答2:

Objective reasons for using spaces instead of tabs for indentation? [closed]

橙三吉。 提交于 2019-12-09 15:53:44
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . Are there objective reasons for using spaces instead of tabs for indenting files as per PSR-2 standard, can someone provide: facts, references, specific expertise on which PSR-2 standard is based? Authors of PSR-2 standard had in mind something more than "look and feel",

Visual Studio - “{ }” settings

回眸只為那壹抹淺笑 提交于 2019-12-09 14:04:22
问题 Seriously, I don't know what to google. Here's the thing, I like this java-like code writting: if (condition == true) { doSomeStuff(); } But VisualStudio "helps" me with his own "style", which I don't like and I am unable to change (after rather big time of desperate checking all settings :/) if (condition == true) { DoStuff(); } I obviously want the "{" char to be in same line where condition is ... I am using MS Visual Studio 2010 professional Any help appreciated! 回答1: Go to Tools >