indentation

Visual Studio 2015 - How to Preserve Indentation of Comments?

血红的双手。 提交于 2019-12-11 06:27:39
问题 Simple question. No answer given anywhere on the internet? I program in C++ / C# in VS2015 community. When i comment out code and then close the ide and reopen it, this commented code loses indentation. How do i force VS to preserve indentation? It shouldn't be doing anything to the code / text that is commented. Thanks in advance. 回答1: In VS 2017 (C++) there is a checkbox for this. Tools | Options | Text Editor | C/C++ | Formatting | Indentation | Preserve indentation of comments Unchecking

4 spaces for Indentation - Syntax error

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:56:05
问题 I'm using 4 spaces for indentation, but get a Syntax error. When I use the indentation in the Text editor, works fine. The text editor creates just 1 block, that I'm unable to edit it. Are spaces not able to be used as indentation? def replace_line(file_name, line_num, text): try: lines = open(file_name, 'r').readlines() lines[line_num] = text out = open(file_name, 'w') out.writelines(lines) out.close() if not var and not var2: return I get the syntax error on the if not var line. 回答1: If you

How to remove indent after annotation in Java

冷暖自知 提交于 2019-12-11 05:37:36
问题 I have @Override annotation in my java code, but vim indent the next line automatically like this: @Override public String toString() { //some code } How can I get rid of the indent? As far as I know, the indent file java.vim in /usr/share/vim/vim73/indent has addressed the problem, yet the problem still remains. Here's the code in java.vim : " If the previous line starts with '@', we should have the same indent as " the previous one if getline(lnum) =~ '^\s*@\S\+\s*$' return indent(lnum)

Indentation error: expected an indented block python 3.6 [closed]

馋奶兔 提交于 2019-12-11 05:28: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 2 years ago . I am a newbie in python. I wanted to return string "shutting down" if s==yes . Pls tell me what could be wrong in the below code. def shut_down(s): ... if s == "yes": File "<stdin>", line 2 if s == "yes": ^ IndentationError: expected an indented block 回答1: tl;dr try to add 4 spaces to the start of your second

Specific Indentation error in nested if statement in for loop

走远了吗. 提交于 2019-12-11 05:20:28
问题 I have the following code and in the login feature, the output is erroneous (a logic error). It basically prints "invalid username and password" until it gets to the right one, and then prints "correct login". ERRONEOUS OUTPUT : For example, with the test data: user3 and pass3, the output is: *****LOGIN SCREEN****** Username: user3 Password: pass3 invalid username or password invalid username or password correct login >>> Here is the code in question, with reference to the LOGIN function:

Override TAB inside a Browser

南楼画角 提交于 2019-12-11 03:46:06
问题 If I'm typing text in a input field and press ENTER the default behavior of all the browsers I know is to submit the form, however if I press ENTER inside a textarea a new line is added. Is there any way to mimic this behavior (indent, not submit the form) whenever I press TAB inside a textarea? Bespin seems to do it, but in a canvas element. 回答1: I haven't done it myself, but it seems to be possible to override the event handler and catch the key. See e.g. here. Oh and for the JQuery crowd

Reading XML file and indenting

[亡魂溺海] 提交于 2019-12-11 03:14:08
问题 I've been having problems with the indentation of my XML files. Everytime I load them from a certain server, the XML nodes all jumble up on a few lines. I want to write a quick application to indent the nodes properly. That is: <name>Bob<name> <age>24</age> <address> <stnum>2</stnum> <street>herp derp st</street> </address> currently it's coming out as : <name>bob</name><age>24</age> <address> <stnum>2</stnum><street>herp derp st</street> </address> since I can't touch the internal program

Formatting in NetBeans: CSS specific

北战南征 提交于 2019-12-11 02:46:55
问题 I would like to use spaces for indentation for most code, but use tabs for indentation in CSS. In Visual Studio and Notepad++, you can configure this for all languages. But in NetBeans (setup for PHP), I can only select "All languages" or "PHP". Is there a way to make other languages have specific formatting settings (specifically CSS)? 回答1: Depending on the IDE modules that you have, you will see PHP, Java or All Languages. But there is no way to change formatting styles for CSS-only in

Indentation and smart indent in ScintillaNET

ε祈祈猫儿з 提交于 2019-12-11 01:39:36
问题 Can someone describe me how to make indentation work in Scintilla.net? this.scintilla1.Indentation.SmartIndentType = ScintillaNet.SmartIndent.Simple; I'm confused on what needs to be done to get it to work. Can someone describe what event handlers need to be implemented to get indentation to work? 回答1: The trick is to set Indentation.IndentWidth to 8 , if Indentation.TabWidth is also set to 8 . Of cource Indentation.SmartIndentType must still be set to Simple . 来源: https://stackoverflow.com

How to get reliable indentation in elisp

家住魔仙堡 提交于 2019-12-10 23:47:10
问题 I'm new to Emacs. I'm trying to write an elisp function that works across all modes. Specifically, I want to write a function that inserts braces (a bit like insert-parentheses ) in the same way the following key sequence does for a dumb editor that only supports auto-indent: "{" <ret> "}" <up-arrow> <end> <ret> <tab> This key sequence works for both Java and C# (bsd) style indentation. I need it to work in all brace-y emacs modes, and also in plain text files - I have other formats that have