VS Code indenting substituting spaces for tabs? - visual-studio-code

I am developing in Python via remote-SSH in VS-Code. After a particularly hasty shutdown due to physical issues with the remote server where I commanded a shutdown from within the terminal, I came back to VS-Code to discover that all of the formatting in my remote workspace was entirely screwed up.
Specifically, pressing Tab to indent would invariably give four spaces despite indicating "Indent Using Tabs" with size 4, in both the User and Remote settings tabs. What's even more confusing is that when I insert a newline, tabs are substituted by spaces, i.e. if I am entering a new-line on a twice-indented line, the next line is indented by two spaces instead of two tabs, etc.
VS Code substitutes a space for a tab
I am not running many extensions, just all the Microsoft Python extensions, as well as IntelliCode. I am not running Prettier.
Attempts to fix it include various combinations and permutations of forcing the entire document to indent using tabs, converting all the spaces to tabs, and converting all of the tabs to spaces in some vague hope of resetting whatever widget is broken within VS-Code, none of which have had any effect.
If anyone has encountered this before or knows exactly what is causing this issue, I would be extremely grateful.

Solved. For some reason Python Indent was installed in my local extensions, and it was auto-correcting the indents. Closing the issue in 2 days

Related

What is the difference between empty space (>> >> >>) and empty space(......) in eclipse ide?

I know that,empty space (>> >> >>) in eclipse occurs due to use of keyboard(Tab) and empty space(......) occurs in eclipse due to use of Keyboards(Space bar) in the java editor.
What is the significance of it in programming and in the editors? Why is it shown differently in the Eclipse editors? What is the actual use of it and where it helps?
Can it allow to represent in the same way for, characters like new line(\n),vertical tab (\v),form feed (\f) etc.?
There are three ways of indenting: spaces, tabs and hybrid.
Spaces are environment-invariant: if you are indenting by two spaces, it will be two spaces in every terminal, every editor. Different programming languages have different coding style mores. E.g. Ruby is usually written with two-space indents, Python with four-space ones. Some people like space-based indentation, and can be very vocal about it.
Tabs will usually see people indenting by exactly one tab. It is up to the environment how to display it. The default is usually one tab in every 8th column, but editors will usually be able to adjust this. That way, if you disagree with a colleague about how many spaces are best, each can set their own environment as they wish. Some people like tab-based indentation, and can be very vocal about it.
Hybrid is a nightmare. If you mix spaces and tabs, expect trouble, as it will typically happen that you will encounter pieces of code that are horribly misformatted, wherever that colleague touches it. Avoid hybrid indentation at all costs. The only people who don't absolutely hate hybrid indentation are those who haven't dealt with it yet, or don't understand why any of this is happening.
Now, it is very hard to avoid the hybrid indentation if you don't know which indentation method is actually present in the file, especially if your editor is helpfully emulating tabs when you have space indentation, e.g. by deleting the whole indentation level when you press a single backspace (as is normal in most editors).
Furthermore, there are some horrible programming languages (such as Whitespace and Makefile) that semantically distinguish spaces and tabs, and it is thus critically important to see what each character actually is.

How to allow tab to always insert a set number of spaces in Visual Studio (2017)?

I am using Visual Studio 1.19 on Ubuntu (deb). I already killed all the IntelliSense stuff and I wanted to also update tab behaviour. I want a tab to be just a tab. Sometimes when I am commenting (e.g. in C++), it tries to align with the line above and matches that line vertically resulting in more or less then 4 spaces that I desire. I tried playing with User Settings with no luck.
Which settings do I need to amend to achieve specified number of tabs at all times?

Treating spaces as tabs in VS Code

I started working VS Code at work and at home recently, and have run into a weird issue; I'm not sure if it's a setting I can't find or a bug, so thought I'd ask.
I have VS code setup (in both environments) to indent 4 spaces on tab, however, on my work computer, when I navigate over the 4-space-tabs, the IDE advances the full 4 spaces, treating it like a tab but using 4 spaces. On my laptop, I have to advance space by space, and it's pretty annoying. I have the same extensions on both, none of which affect spaces as far as I know.
Any advice?
Look into this setting on both of your work and laptop computers

Eclipse "Correct Indentation" ignoring spaces vs. tabs setting

I'm running Eclipse Juno Service Release 2 (20130225-0426) in Windows and I'm finding that auto-indent (Ctrl-I) ignores both the General/Editors/Text Editors/Insert spaces for tabs and Java/Code Style/Formatter/Indentation/Tab policy="Spaces only" settings. With both of those set, Ctrl-I indents the code with a combination of tabs and spaces, even though Ctrl-Shift-F uses spaces only. The problem is I don't want Eclipse to reformat my code -- just correct the indentation with spaces.
Is this a known bug or am I missing a setting somewhere? Thanks!
It appears the "Correct Indentation" (Ctrl+I) will attempt to copy whatever indentation was used on the line of code immediately preceding your selected block. (Even if that line is using a combination of tabs and spaces!) If I select the whole file then it actually uses my preferences.
Seems pretty deliberate to be a bug though in my opinion there should at least be an option for it. I looked through the Eclipse bug tracker for a while and didn't see anything.

Setting up your editor: indentation and encoding

I'm developing a small project with some friends and we're facing some indentation issues. Each of us is using a different editor (we all have different favorites :) and we also are on different operating systems.
What is the best solution to be able to all develop together and set our programming editors so indentation and encoding is the same? What settings do you recommend and why?
You should have your version control system handle the line ending problems. In SVN, the "svn:eol-style" property can be set to "native" to handle auto-converting the line endings. I assume your code is ASCII or UTF8 so you don't have problems with character encoding.
As far as formatting goes, you'll have to choose roughly some style, such as where to put the braces, but there's no reason you have to have the same indent style, provided you use the same number of indents. That's a confusing statement, so allow me to explain: nearly every IDE ever has the ability to set tab widths to any value you want. If one team member likes to indent 2 character widths, another 4, that's fine. One tab character stored in the file can display either way based on IDE settings. Just configure your IDE to indent with tabs and then set the tab widths per your desires.
(at the risk of starting a flame war, this is why I am solidly in the camp of tabs in the tabs vs spaces war. strangely, the spaces folks seem to consider this very feature the reason to use spaces... I will never understand them).
If you are all insistent to have your own indentation settings, then you will need to use exclusively the tab character to indent the code. (Provided your various editors support this).
This approach is counter to the general consensus of using spaces and only spaces for indenting purposes.
Whatever you do, I recommend converting tabs to a common number of spaces. I know Eclipse can do this on the fly, but I'm not sure if edits like gvim can. In any case, with all spaces it is not up to the individual editors/IDEs to interpret how many spaces make up a tab. Also, if anyone's using a Windows editor/IDE, set it to use Unix-style newlines, so that you don't get the annoying ^M at the end of every line when you edit in a different OS.