indentation

Indentation shortcuts in Visual Studio

自古美人都是妖i 提交于 2019-12-02 13:52:50
I'm new to Visual Studio 2010 and C#. How can I indent the selected text to left/right by using shortcuts? In the Delphi IDE the equivalents are Ctrl + Shift + I and Ctrl + Shift + U Tab and Shift + Tab will do that. Another cool trick is holding down ALT when you select text, it will allow you to make a square selection. Starting with VS2010, you can start typing and it will replace the contents of your square selection with what you type. Absolutely awesome for changing a bunch of lines at once. Tony Hopkinson Ctrl - K , Ctrl - D Will just prettify the entire document. Saves a lot of messing

Converting multiline, indented json to single line using javascript

懵懂的女人 提交于 2019-12-02 12:13:12
I've come up with the following function for converting a multiline, nicely indented json to a single line function(text) { var outerRX = /((?:".*?")|(\s|\n|\r)+)/g, innerRX = /^(\s|\n|\r)+$/; return text.replace(outerRX, function($0, $1) { return $1.match(innerRX) ? "" : $1 ; }); } Can anyone come up with something better, both in terms of efficiency and fixing bugs that exist in my implementation (e.g. mine breaks when parsing { "property":"is dangerously spaced out" } or { "property":"is dangerously \" punctuated" } For this kind of problem, I follow the adage that adding regex just gives

Indenting Javascript in Vim - Problems with Lambda Functions in Functions

半城伤御伤魂 提交于 2019-12-02 04:17:34
I have a problem with javascript indenting in vim. Everything works great, except that the indenting of inline functions as parameters of a function do not work. This is a javascript only problem (no html involed). Example someFunc(function() { if(foo) { bar; } else { bar; } }); is indented to someFunc(function() { if(foo) { bar; } else { bar; } }); Do you have the same problems? How can I fix that? I tried some scripts from vim.org but they seem to have the same problem. A script that emulates TextMates javascript indenting functionality would be perfect. Vim's built in expression for

Controlling Output Indentation in ASP.Net MVC

无人久伴 提交于 2019-12-02 02:52:39
问题 My colleague is extremely 'hot' on properly formatted and indented html being delivered to the client browser. This is so that the page source is easily readable by a human. Firstly, if I have a partial view that is used in a number of different areas in my site, should the rendering engine be automatically formatting the indentations for me (ala setting the Formatting property on an XmlTextWriter)? Secondly, my colleague has created a number of HtmlHelper extension methods for writing to the

Controlling Output Indentation in ASP.Net MVC

孤者浪人 提交于 2019-12-02 02:23:05
My colleague is extremely 'hot' on properly formatted and indented html being delivered to the client browser. This is so that the page source is easily readable by a human. Firstly, if I have a partial view that is used in a number of different areas in my site, should the rendering engine be automatically formatting the indentations for me (ala setting the Formatting property on an XmlTextWriter)? Secondly, my colleague has created a number of HtmlHelper extension methods for writing to the response. These all require a CurrentIndent parameter to be passed to them. This smells wrong to me.

Python: prevent mixed tabs/spaces on module import

我的未来我决定 提交于 2019-12-02 01:50:10
I know you can ensure pure tabbed/spaced code by calling Python with -tt . However, when I have no control over the top-level call, can I still enforce this behaviour on the modules that are loaded by my script? If you have control about the initial script, then you can just add a check for it yourself. For example, instead of just importing your student’s script, you could have a function that first checks the module for indentation errors, and then imports it: # instead of import foo foo.bar() # you have something like foo = verifyAndImport('foo') foo.bar() And the verifyAndImport would look

Jasper Report HTML bullet hanging indent

时间秒杀一切 提交于 2019-12-02 01:22:31
I have a Jasper report which uses HTML markup tag to display the li tag list. However, it seems that even with the latest version of the Jasper report, it still cannot do the hanging indent correctly. This is what I want: TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test This is what I get: * TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST *

Possible mixed indentation in Python?

跟風遠走 提交于 2019-12-01 22:11:29
问题 Looking at this question, I tried OP's the code on my machine. Here are a text version and a screenshot: What just happened? This supposed to be a square function, and it is implemented correctly. To be sure, I copy-pasted the code, and tried it again: Well, I can't see any difference between these versions of square , but only the latter works. The only reason I can think of is that I may have mixed tabs and spaces, so the return statement is actually indented, and so the loop is executed

Possible mixed indentation in Python?

萝らか妹 提交于 2019-12-01 21:18:50
Looking at this question, I tried OP's the code on my machine. Here are a text version and a screenshot: What just happened? This supposed to be a square function, and it is implemented correctly. To be sure, I copy-pasted the code, and tried it again: Well, I can't see any difference between these versions of square , but only the latter works. The only reason I can think of is that I may have mixed tabs and spaces, so the return statement is actually indented, and so the loop is executed exactly once. But I could not reproduce it, and it looks like an unbelievable flaw in the interpreter's

Checkstyle equivalent for JSPs?

泄露秘密 提交于 2019-12-01 20:53:39
Is there any tool to do for JSP files what checkstyle does for Java files? The ideal would be to include JSP checking on checkstyle, but as far as I can see, this isn't possible. I would like for example to check JSP files for : Indentation style Right placements of certain constructs Tab / space check Check for use of scriplets Thanks Emerson Yes, there is something similar (but not for exactly those checks): You can use IntelliJ IDEA's "Inspection" functionality to inspect JSPs for various problems, and those inspections can be run from the command line too (use inspect.bat in IntelliJ's