code-formatting

Multiple lines comments in Scheme (RnRS)

独自空忆成欢 提交于 2019-12-06 05:31:45
问题 I created this solution: ; use like this: ; (/* content ... */ <default-return>) ; or ; (/* content ... */) => #f (define-syntax /* (syntax-rules (*/) ((/* body ... */) #f) ((/* body ... */ r) r))) But is it really the best or easiest way? 回答1: You can't do it this way -- it won't work for a number of contexts. Here are some examples that won't work: (+ (/* foo */) 1 2) (define (foo a (/* b */) c) ...) (/* foo; bar */) (/*x*/) (let ((x (/* 1 */) 2)) ...) (let ((/* (x 1) */) (x 2)) ...) (car '

Is the Open Source Jalopy Eclipse plugin compatible with Ganymede?

穿精又带淫゛_ 提交于 2019-12-06 03:41:56
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? VonC 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 formatters (look for the term 'formatter' in those building notes of jdt-core . It also can be run from the

How Do I Avoid Line-Break Padding?

≡放荡痞女 提交于 2019-12-05 22:23:00
问题 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

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

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 20:33:34
问题 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

my vs2008 addin for textformatting is awfully slow

你离开我真会死。 提交于 2019-12-05 18:22:07
i wrote a little addin, which does some formatting of my C# code. in the addins Exec method i do the following try { TextSelection selection = (EnvDTE.TextSelection)_applicationObject.ActiveDocument.Selection; String foo = String.Empty; if (!text.IsEmpty) { foo = someCoolObjectThatFormatsText.Format(selection.Text); selection.Text = foo; // here everything gets painfully slow :-( } } catch (Exception) { throw; } when the line with the code "SelectedText.Text = foobar;" is call, VS rebuilds each line of the selection step by step. You can easily watch it doing this step. But i don't get, why it

Dealing with ASP.NET MVC “tag soup”

梦想的初衷 提交于 2019-12-05 13:09:21
I was working on an ASP.NET MVC template today, and after staring at all those fluorescent yellow % tags for long enough, I basically decided I had had enough, so I painstakingly modified my ascx file to look like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% if (Model == null) { %> <%= ViewData.ModelMetadata.NullDisplayText %> <% } else if (ViewData.TemplateInfo.TemplateDepth > 1) { %> <%= ViewData.ModelMetadata.SimpleDisplayText %> <% } else { %> <% foreach (var prop in ViewData.ModelMetadata.Properties.Where( pm => pm.ShowForDisplay && !ViewData

How to force code style formatting as part of the build?

醉酒当歌 提交于 2019-12-05 12:44:00
Is there a way (using ANT), it is possible to automatically reformat code to follow certain conventions? I have several developers working on a program and would like to guarantee that code formatting becomes consistent across all classes at build time, prior to commit The best way to do it pre-commit is to use a pre-commit hook on your source control server. This way you can enforce that no code makes it into the branch without conforming to code standards. http://checkstyle.sourceforge.net/ can be used as an ANT task or pre-commit hook. So you can run this on the source control server or as

Visual Studio C++ “Automatically format completed block on }”

﹥>﹥吖頭↗ 提交于 2019-12-05 11:57:30
Visual Studio has this setting for C#, but I can't find it for C++. "Automatically format completed block on }" I used this feature a lot while working on C# stuff & now that I'm back on C++ (which I prefer), I miss the feature. How can I set this up? I assume I'd have to use a 3rd party plugin or something at this point, but I can't find any relevant ones in all my searching. What the feature does: If I have a section of code & type '{' before it, then type '}' after it, it will automatically tab it in to match the tabbing rules that make the code easier to read. Ex: Start off with some code:

Generating well-formatted syntax with Roslyn

邮差的信 提交于 2019-12-05 10:09:05
I am using Roslyn to modify the syntax of C# files. Using CSharpSyntaxRewriter, it is very easy to find and replace nodes in the syntax tree. However, the generated code is very ugly and won't even parse in all cases because the syntax nodes I create (using SyntaxFactory) lack even a minimal amount of whitespace trivia. Does Roslyn provide some basic formatting functionality to avoid this or do I have to add trivia manually to each node I create? pg0xC Yes - it is possible, using Microsoft.CodeAnalysis.Formatting.Formatter : var formattedResult = Formatter.Format(syntaxNode, workspace); 来源:

How do I change the way the RAD Studio (2010 and later) IDE formats my code?

删除回忆录丶 提交于 2019-12-05 10:07:31
问题 How do I configure the RAD Studio IDE to format my code with begin on either the same or next line when I use the Format Source option? One of the most commonly debated preferences is the position of begin - on the same line or a line of its own. How do you set Delphi to format your source with begin on one line or the other in Delphi XE2? This is referring to when you go to Edit > Format Source 回答1: I am answering this question Q&A style. Go to Tools > Options Find the Formatter section in