indentation

Indentation of IF-ELSE block in python

醉酒当歌 提交于 2019-12-01 05:47:34
问题 Hi I am python newbie and I am working on NLP using python. I am having a error in writing if-else block in python. When I am writing only if block at that time it is working fine: if xyzzy.endswith('l'): print xyzzy after entering colon I am pressing enter and it is automatically taking me to the correct indentation. but when I am trying to add else block to it after pressing "Enter" key after print statement, it is considering it to be statement of IF block only so it is giving me incorrect

Indent preprocessor directives as C code in emacs

只愿长相守 提交于 2019-12-01 05:29:16
问题 Emacs, by default, does not indent pre-processor code. I know it has historical roots that are obsolete by now. However, having a code with a lot of #ifdef unindented is hard to read. So I would like to make emacs automatic indentation give me something like that: void myfunc() { int foo; #ifdef BAR printf(foo); #endif return foo; } Instead of what I get now : void myfunc() { int foo; #ifdef BAR printf(foo); #endif return foo; } Any leads on that issue you emacs hackers :) ? 回答1: You can

Update current indentation spaces size in WebStorm 2016

余生长醉 提交于 2019-12-01 04:30:38
I need to switch from a 2 spaces indentation style to a 4 spaces one within an automatically created Ionic project. I'm running WebStorm 2016.1 on Mac OS X. I already tried to change: WebStorm | Preferences | Code Style | JavaScript | Tabs and indents and play with indent size, tab size, use tab character etc... but no change seems to have effect on existing (and new) JavaScript files. Any idea about how to achieve it? Might some general setting prevent this changes to take effect? Do you have .editorconfig file in your project? Settings from there will overwrite your Code Style settings (and

Java: IndentingXMLStreamWriter alternative?

依然范特西╮ 提交于 2019-12-01 04:07:13
I am using StAX to create a quite large xml document. Until now I was using the IndentingXMLStreamwriter class to get a well formatted document (see also this answer ). A few days ago we setup a jenkins server with an older jdk version (6.26), on which i get build errors. package com.sun.xml.internal.txw2.output does not exist I assume the package cannot be found because of the installed jdk version. For different reasons this cannot be changed (by the way, does anyone know the jdk version, at which this package (com.sun.xml.internal.txw2.output) was added?). Therefore I am looking for an

Update current indentation spaces size in WebStorm 2016

主宰稳场 提交于 2019-12-01 03:06:08
问题 I need to switch from a 2 spaces indentation style to a 4 spaces one within an automatically created Ionic project. I'm running WebStorm 2016.1 on Mac OS X. I already tried to change: WebStorm | Preferences | Code Style | JavaScript | Tabs and indents and play with indent size, tab size, use tab character etc... but no change seems to have effect on existing (and new) JavaScript files. Any idea about how to achieve it? Might some general setting prevent this changes to take effect? 回答1: Do

VS Code Auto Indent / Code Formatting changes single quotation marks to double

牧云@^-^@ 提交于 2019-11-30 21:50:21
问题 I am using VS Code 1.17.2 with the following extensions installed (Unfortuanetly i can't link them since i don't have enought reputation): Angular 5 Snippets - TypeScript, Html, Angular Material, ngRx, RxJS & Flex Layout Angular Essentials Angular Language Service Angular v5 TypeScript Snippets angular2-inline Auto Import Debugger for Chrome EditorConfig for VS Code (since Angular Essentials depends on it) HTML Snippets IntelliSense for CSS class names Material Icon Theme Path Intellisense

Haskell Error: parse error on input `='

冷暖自知 提交于 2019-11-30 19:59:54
Specs GHC 6.12.1 Mac OS X 10.6.4 x64 MacBook Pro Problem I'm having trouble using let syntax. The following code refuses to compile: module Main where main = let x = 1 y = 2 z = 3 in putStrLn $ "X = " ++ show x ++ "\nY = " ++ show y ++ "\nZ = " ++ show z I tried tabbing in y = 2 and z = 3 even more. No dice. (Undesirable) Solutions The only way I've gotten the code to compile is either Replacing hard tabs with spaces. Replacing the let clause with a where clause. Saizan on #haskell explains that the assignments in a let expression have to align, not let itself. As long as the assignments line

IndentationError: unexpected unindent WHY?

a 夏天 提交于 2019-11-30 17:23:27
IndentationError: unexpected unindent WHY??? #!/usr/bin/python import sys class Seq: def __init__(self, id, adnseq, colen): self.id = id self.dna = adnseq self.cdnlen = colen self.prot = "" def __str__(self): return ">%s\n%s\n" % (self.id, self.prot) def translate(self, transtable): self.prot = "" for i in range(0,len(self.dna),self.cdnlen): codon = self.dna[i:i+self.cdnlen] aa = transtable[codon] self.prot += aa def parseCommandOptions(cmdargs): tfname = cmdargs[1] sfname = cmdargs[2] return (tfname, sfname) def readTTable(fname): try: ttable = {} cdnlen = -1 tfile = open(fname, "r") for line

How to get smart tabs (“indent with tabs, align with spaces”) behavior in Xcode?

允我心安 提交于 2019-11-30 17:11:17
I used to use tabs for indentation and spaces for alignment. Like so (arrows show tabs and dots show spaces). In QtCreator you can set such coding style in standard preferences. I can't find the way to achieve the same goal in Xcode. Could you please tell me if it is possible? May be there is a plugin for that? UPDATE: Here is how it can be achieved in QtCreator: P.S. Please, don't try to persuade me that using spaces only/tabs only is better, otherwise this question will turn into another holywar :) Once more about what I'm trying to achieve: Indent with tabs, align with spaces. Vim Tips Wiki

Make Emacs less aggressive about indentation

独自空忆成欢 提交于 2019-11-30 15:26:34
Emacs reindents the current line whenever I type certain things, like ";" or "//". This is pretty annoying, since there are a whole lot of places where it isn't smart enough to indent correctly. How do I disable this feature? I still want to be able to indent the line with TAB, but I don't want any source code I type to cause it to reindent. (I'm using Dylan Moonfire's C# mode, but this probably applies to any cc-mode.) Try running c-toggle-electric-state to turn off the electric action of these characters. You can do this as part of a c-mode-common-hook, or toggle the state manually by