code-formatting

Is there a way to mark up code to tell ReSharper not to format it?

I quite often use the ReSharper "Clean Up Code" command to format my code to our coding style before checking it into source control. This works well in general, but some bits of code are better formatted manually (eg. because of the indenting rules in ReSharper, things like chained linq methods or multi-line ternary operators have a str...

Convention for wrapping code lines?

I usually wrap my code lines so that they are up tp 80 characters long. Which wrapping looks better to you? // (A) std::vector<MyLongClassName::size_type>* myvector = new std::vector<MyLongClassName::size_type>(); bool isOneOrAnother = hereIsOneLongCondition && hereIsAnotherOne; // (B) std::vector<MyLongClassName::size_type>* ...

Committing when changing source formatting?

Is it accepted practice to commit even when you're just changing things like whitespace, code formatting, etc.? ...

VS2008 XAML code formatter

In my team, the code style in .xaml files are currently not very consistent. We looked over the Visual Studio auto formatter to make it format the code into something we like. However, for one option we lack an extra condition. The options Im talking about are found under Tools -> Options -> Text Editor -> XAML -> Formatting. We want ea...

Dealing with ASP.NET MVC "tag soup"

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) { ...

Eclipse Galileo SQL Editor: is there a code formatter (tidy) function?

I do like the SQL editor now bundled with Eclipse but I can't seem to find a way for it to format my code like eclipse will with my java. Did I miss something, or does anybody have any alternatives? Thanks ====EDIT==== I'd also be happy if there was an alternate plug-in that someone could recommend. ...

What is the most common, industry preferred formatting method?

I couldn't seem to find a good question on SO, or a good Google search that seemed to answer my question. What is the industry or popular preference when it comes to formating code "chunks" and their brackets. Here are some examples for what I am trying to explain... if($foo) { return $bar; } else { return $stackOverflow; } VS...

C# or javascript code formatter

I'm currently using Syntax Highlighter to show a XML or SOAP messages on a page. That works fine for messages that are already formatted correctly (line breaks, indents, etc). But if I had a XML string like: string xml = "<doc><object><first>Joe</first><last>Smith</last></object></doc>"; I would write the string to the page and the ...

Value of whitespace in html source code

I'm using a function to generate all output in php. Using that function I can control whether to display the code like this: <html><header></header><body><p>Hello World!</p></body></html> or like this <html> <header> </header> <body> <p>Hello World!</p> </body> </html> including the indentation and all. Is there a particular v...

C++ Pointer in Function

Possible Duplicate: Whats your preferred pointer declaration style, and why? I know that technically all three ways below are valid, but is there any logical reason to do it one way or the other? I mean, lots of things in c++ are "technically valid" but that doesn't make them any less foolish. int* someFunction(int* input) {...

Is there any way in Eclipse to format a code that contains divs in the way Netbeans do it?

Is there any way in Eclipse to format a code that contains divs in the way Netbeans do it? I mean, if you have this in Netbeans: <div> </div> </div> <div> and you format it (Source > Format), it becomes this way: <div> <div> </div> </div> ...

Are there any lint tools for C and C++ that check formatting?

I have a codebase that is touched by many people. While most people make an effort to keep the code nicely formatted (e.g. consistent indentation and use of braces), some don't, and even those that do can't always do it because we all use different editors, so settings like spaces vs. tabs are different. Is there any standard lint tool...

Code Alignment In SQL Server 2005

I am using SQL Server Management Studio. I want to know the shortcuts for easily aligning the T-SQL Queries and codes in a beautiful format for easy readability and understandability. Please Let me know how to align the code without using any SQL Server formatting / aligning tools. Please do give your valuable tips to align the same, ...

Is there any tool to standardize format of C++ code?

Hello, all :) I'm looking for a tool that works on Windows to reformat some C++ code in my codebase. Essentially, I've got some code I wrote a while ago that I'd like to use, but it doesn't match the style I'm using in a more recent project. What's the best way to reformat C++ code in a standard manner? Billy3 ...

Formatting the code en-masse in Visual Studio

I've inherited a project where all the private variables, and there are thousands, are separated by a blank line. For instance, private pnlSecurityReport _pnlSecurityReport = null; private pnlCalendar _pnlCalendar = null; private CtlContacts _pnlContacts = null; private pnlEmails _pnlEmails = null; private CtlNo...

How to format long strings in arrays

How should I format very long strings in my source code? I follow the rule, that line of code should not be longer than 80 characters. (The other rules are Zend Framework formatting standard) e.g. protected $_messages = array( 'key1' => 'very, very long string lorem ipsum dolor sit amet…', 'key2' => 'this one it very long too,...

Script to rebuild git history, applying code cleanup to every version

Has anyone got a script for git that can go through the history, check out each version, apply a cleanup script, then check the cleaned version into another repository? I have some code which I've been developing, but I haven't been consistent with code formatting e.g. tabs vs spaces etc. I'd like to rewrite my entire history to be cons...

LaTeX lstlisting not highlighting keywords when basic style is ttfamily

Hello, I'm working on a LaTeX document and using lstlisting to display my Java source code. My setup looks like this: \lstset{ basicstyle=\ttfamily, keywordstyle=\bfseries, language=Java, frame=single, aboveskip=11pt, belowskip=11pt, breaklines=true, breakatwhitespace=false, showspaces=false, showstringspaces=false } The k...

format ugly c# source code

I found a C# game http://www.codeproject.com/KB/game/BattleField.aspx that does what I need to learn. The source code is poorly formatted and hard to follow. I used Visual Studio's format document, but the format is still bad. How do I reformat the source code to make it easer to read? ...

notepad++ tab to left

if i press tab the line moves to right, what i must press to move line to left? ...