code-formatting

Format HTML document [closed]

China☆狼群 提交于 2019-12-02 21:32:07
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I like the feature in Visual Studio for formatting an HTML document ( CTRL + K , CTRL + D ). Is there a plugin with the same functionality in any other (free) editors, e.g. Notepad++? Emre Yazici If you mean colorizing and formatting from "Format", Notpad++

Eclipse Javascript formatter (ctrl-shift-f)

↘锁芯ラ 提交于 2019-12-02 20:20:51
I don't like asking this question but I have honestly been looking for a way to figure this out for a very long time. This is a simple question. I have been using NetBeans for a long time, but recently made the switch to Eclipse for a few reasons I won't get into. Anyway, I find the javascript source formatting behavior to be very odd. Here is an example block of javascript code that I formatted myself: function buildDatabase () { db.transaction(function (tx) { tx.executeSql('DROP TABLE IF EXISTS calendar'); tx.executeSql('CREATE TABLE IF NOT EXISTS calendar(id UNIQUE, summary, description,

Declaring long strings that use string interpolation in C# 6

左心房为你撑大大i 提交于 2019-12-02 20:16:52
I usually wrap long strings by concatenating them: Log.Debug("I am a long string. So long that I must " + "be on multiple lines to be feasible."); This is perfectly efficient, since the compiler handles concatenation of string literals. I also consider it the cleanest way to handle this problem ( the options are weighed here ). This approach worked well with String.Format : Log.Debug(String.Format("Must resize {0} x {1} image " + "to {2} x {3} for reasons.", image.Width, image.Height, resizedImage.Width, resizedImage.Height)); However, I now wish to never use String.Format again in these

Is it possible to prettify scala templates using play framework 2?

旧街凉风 提交于 2019-12-02 17:38:00
Using Play Framework 2 I've noticed the rendered Scala HTML templates don't like indented @if or @for . So, for example, something like that: <ul> @for(test <- tests) { <li>@test.name</li> } </ul> Will have extra unneeded spaces. To fix it, I need to do something like that: <ul> @for(test <- tests) { <li>@test.name</li> } </ul> Which will get messy with additional @defining or other statements. So, is there a way to prettify/beautify Scala templates rendering in order to get rid of extra white spaces? UPDATE: Reading this thread I've noticed extra spaces and line breaks are added as well

Format Ruby code in Vim

旧街凉风 提交于 2019-12-02 16:40:32
Just moving over to Vim at the moment. In TextMate I could format code by hitting Cmd - Alt - [ . How do I achieve the same in Vim? See the answer below for the command. I found I also needed the following in my .vimrc so that Vim knew how to autoindent Ruby. if has("autocmd") filetype indent on endif Vimcasts has a useful screencast on this subject that you may be interested in gg=G gg => go to start of file = => apply autoformatting G => ... to the end of file When I see questions about Vim and reformatting and reindenting, I usually feel confusion. But it is pretty easy. Reindenting, done

How to format html files in Eclipse?

﹥>﹥吖頭↗ 提交于 2019-12-02 16:31:39
The XML formatting works perfect but not the html formatting. In fact if I use "cmd-shift-F" for a html file, it just left aligns almost everything. I've attached the before and after pictures. Does anyone know how to fix this? I played around with HTML formatting preferences but had no luck. Note that the same document, if it is saved as xml will format perfectly. I am using eclipse 3.6 with WTP plugin. prasad vsv go to Window --> preferences --> Web --> HTML files --> Editor . In the Inline Elements section, select all the elements that you don't want eclipse to inline(continue with same

How do I avoid expanding folded regions when I invoke the code formatter?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 06:45:40
问题 As you know, Delphi 2010 has built-in code formatting. However, formatting unfolds all folded code blocks. Any ideas how to fix it? This "feature" is particularly annoying for me and I was really astonished when I couldn't find any mention of this problem. What I've tried: Searching for alternative, e.g., GExperts have code formatter plugin, but it also unfolds code blocks. Tried to write a macro for GExperts: Ctrl+D(format code) -> various code folding/unfolding shortcuts, but couldn't

How do I avoid expanding folded regions when I invoke the code formatter?

喜夏-厌秋 提交于 2019-12-01 23:02:22
As you know, Delphi 2010 has built-in code formatting. However, formatting unfolds all folded code blocks. Any ideas how to fix it? This "feature" is particularly annoying for me and I was really astonished when I couldn't find any mention of this problem. What I've tried: Searching for alternative, e.g., GExperts have code formatter plugin, but it also unfolds code blocks. Tried to write a macro for GExperts: Ctrl+D(format code) -> various code folding/unfolding shortcuts, but couldn't manage to make it respect all folded/unfolded block structures. Write a CnWizards script, but could't find a

Stop Visual Studio 2013 from automatically removing extra spaces in assignments

六月ゝ 毕业季﹏ 提交于 2019-12-01 18:57:28
问题 I'm trying to align some assignments to improve readability, but each time I paste something, Visual Studio 2013 automatically removes the extra spaces before the = . For example, this: static class Constants { public static string Something = "A value"; public static string SomethingElse = "Another value"; } gets re-formatted like this: static class Constants { public static string Something = "A value"; public static string SomethingElse = "Another value"; } Is there a way to turn this off?

How to align XML code in Android Studio?

99封情书 提交于 2019-12-01 08:13:45
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. Milon below code will align everything but not after = sign. for better answer here Win/Linux: Ctrl + Alt + L Mac: Option + Command + L Try like this Settings - Editor - XML 来源: https://stackoverflow.com/questions/28245890/how-to-align-xml-code-in-android-studio