Proper indentation for Python multiline strings

What is the proper indentation for Python multiline strings within a function? def method(): string = """line one line two line three""" or def method(): string = """line...

Is there an easy way to return a string repeated X number of times?

I'm trying to insert a certain number of indentations before a string based on an items depth and I'm wondering if there is a way to return a string repeated X times. Example: string indent =...

Show log context level by indentation or prefix length

My idea is to make a context logging scheme as showed on the example below: [ DEBUG] Parsing dialogs files [ DEBUG] ... [DialogGroup_001] [ DEBUG] ...... Indexing dialog xml file...

How do you auto format code in Visual Studio?

I know Visual Studio can auto format to make my methods and loops indented properly, but I cannot find the setting.

How to Pretty Print HTML to a file, with indentation

I am using lxml.html to generate some HTML. I want to pretty print (with indentation) my final result into an html file. How do I do that? This is what I have tried and got till now import...

Can VIM autoindent SQL?

"https://stackoverflow.com/questions/272210/sql-statement-indentation-good-practice/272232#272232" appears to be the accepted format for writing SQL blocks. Is there a Vim indent/syntax file that...

Indentation shortcuts in Visual Studio

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

Vim: insert the same characters across multiple lines

Sometimes I want to edit a certain visual block of text across multiple lines. For example, I would take a text that looks like this: name comment phone email And make it look like...

Python Caesar Cipher Decoder

In my lesson I was tasked with creating a Caesar Cipher decoder that takes a string of input and finds the best possible string using a letter frequencies. If not sure how much sense that made but...

Sublime Text 3 Code autoformatting

I've searched high and low, but I can't seem to find a plugin that makes Sublime work similar to how Visual Studio formats my code as I type it. For example, when I write a for loop, it looks...

Sublime Text 2 plugin editorconfig does not work on Mac OSX

I am used to work with an .editorconfig file at the root of my projects and this one works great with phpstorm. But for some reasons I cannot make it work with Sublime Text 2 on Mac OSX...

Format document in Visual Studio to insert braces?

Is there a way to "Format document" in Visual Studio to insert braces around single-statement blocks for C# code? For example this: if (x) y(); ... would become something like: if (x) {...

vim move a block of selected code up or down

There is a way to move highlighted code up or down with arrow keys. Even the indentation would be correct on dropping the block. For the life of me I do not remember how to do it. Can someone...

Sublime Text - JSON formatter shortcut

I'm using SublimeText2. How to reindent Json code with a shortcut? I've already installed packageControl and it works. I already tried JsonReindent package but it has not a shortcut by default and...

Indent/format code in Visual Studio code on MAC

i'm trying to indent my code in visual studio code. I searched and i found that ctrl + F + K should be work, but it doesn't. I tried cmd + k + f too, but it still not working. I hope you can help me!

How to indent/format a selection of code in Visual Studio Code with Ctrl + Shift + F

I want to indent a specific section of code in Visual Studio Code. I read How do you format code in Visual Studio Code? that gives shortcuts to indent the whole code, but it doesn't work when...

Xcode - changing the indentation rules for switch statements

When I write a Swift switch statement it indents the code like this: switch foo { case 1: // stuff happens default: // other stuff happens } I want it to indent like this: switch foo { ...

Sublime Text 3 is automatically converting spaces to tabs on save, regardless of settings. How can I stop this?

I'm having trouble with Sublime Text 3. Even if I select View > Indentation > Convert tabs to spaces and View > Indentation > Indent using spaces as soon as I save the file it all automatically...

How to keep comments inside a view definition with PostgreSQL?

I need to keep the comments I add inside a SQL query when I create views from complex queries, in order to come back to views definition more easily. Within pgAdminIII, when I create a view and...

I'm getting an IndentationError. How do I fix it?

I have a Python script: if True: if False: print('foo') print('bar') However, when I attempt to run my script, Python raises an IndentationError: File "script.py", line 4 ...

How to format all my vscode files from 4 space indentation to 2 spaces?

How to format all vscode files in my application folder so that all existing codes be formatted to two spaces from 4 space indentation? I understand that at the bottom of my VSStudio web editor, I...

Inconsistent Indentation: How do I fix it?

I am attemping to make a game in JavaScript, but when I try to localhost it in Node.js, i get an error like this: Inconsistent indentation. Expecting either 6 or 8 spaces/tabs. at makeError...

Idiomatic way to create n-ary cartesian product (combinations of several sets of parameters)

To create all possible combinations of two sets of parameters and perform an action on them, you can do: setOf(foo, bar, baz).forEach { a -> setOf(0, 1).forEach { b -> /* use a and b...

Why won't the key combination Ctrl-K Ctrl-F work for php visual code?

I'm intending to format the selection (indentation) for the PHP code, but it does not work. I already made sure that there aren't duplicate shortcuts. I also disabled all extensions. I changed...

Ignoring indentation/alignment changes in git diff

I want to take a patch and apply it in another repository, both the local repository are up to date. I just changed indentation and few lines in the file and took patch using git diff and applied...

In System.Text.Json is it possible to specify custom indentation rules?

Edit: I made an issue at the .Net runtime repo yesterday which was closed to by "layomia" with this message: "Adding extension points like this comes with a performance cost at the lower-level...

TOML vs YAML vs StrictYAML

TOML said "TOML and YAML both emphasize human readability features, like comments that make it easier to understand the purpose of a given line. TOML differs in combining these, allowing comments...

IndentationError: unexpected indent while using opencv (in Atom and comipiling in Macbook zsh Terminal)

File "background.py", line 1 import cv2 ^ IndentationError: unexpected indent I'm getting this error. I've uninstalled and reinstalled opencv through my terminal again. Checked if import...

Roslyn analyzer does not respect .editorconfig

Does anybody know why Roslyn analyzer does not respect indent_style from .editorconfig? I'm using Rider on mac and we decided to configure code rules in our solution. Here's our setup from...

Prettier vscode extension ignoring config files

I can't get the prettier extension to use my config files. It keeps using the global settings (as defined in the config path setting in vscode). I made an example...