How to change tabSize and insertSpaces in vscode - whitespace

How do you actually go about changing the "editor.tabSize" and "editor.insertSpaces" values for vscode? I've opened File > Preferences > User Settings and added:
// Place your settings in this file to overwrite the default settings
{
// Controls the rendering size of tabs in characters. If set to auto, the value will be guessed based on the opened file.
"editor.tabSize": 4,
// Controls if the editor will insert spaces for tabs. If set to auto, the value will be guessed based on the opened file.
"editor.insertSpaces": true,
}
However, when I open an html file with two-space tabs, pressing tab inserts two spaces, and when I open a file that uses \t tabs, pressing tab inserts \t.
What am I doing wrong that causes vscode to not respect my settings?

There is a trailing comma in your snippet and currently VSCode fails to understand settings with malformed JSON. I am happy to say that with the next update, this issue should be fixed :)!
The working version of settings is:
// Place your settings in this file to overwrite the default settings
{
// Controls the rendering size of tabs in characters. If set to auto, the value will be guessed based on the opened file.
"editor.tabSize": 4,
// Controls if the editor will insert spaces for tabs. If set to auto, the value will be guessed based on the opened file.
"editor.insertSpaces": true
}

Related

vscode-go input tabs of size 4 instead 8

I have Visual Studio Code Insiders installed. Basically I've installed Go extension from Microsoft and written simple hello world app. Now I always use spaces to indent my code, but I saw that it changed to tabs of size 4. So I thought: yay, what a nice extension, now I can start to write my code.
Then I remembered, that the default code indent from gofmt should be 8 as tabs. And I checked. gofmt main.go indeed outputs my code with tabs of size 8. But vscode keeps doing tabs of size 4. I thought maybe it doesn't even call gofmt but when I go RPM->Format document with - it actually does. But still, tabs of size 4. What am I doing wrong in this scenario?
"editor.renderWhitespace": "all",
"editor.fontFamily": "Hack",
"editor.fontSize": 12,
"editor.minimap.enabled": false,
"editor.fontLigatures": true,
"workbench.editor.enablePreview": false,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.cursorSmoothCaretAnimation": true,
"editor.detectIndentation": false
Those my only editor settings and I dont have any custom settings regarding Go extension
go fmt uses tab characters ("\t") to indent the beginning of a line. How a tab is displayed (tab width) is up to your text editor or IDE. I have Tab Width set to 4 in my text editors. My terminal program uses a tab width of 8.
For example, for xed,
Editor Preferences
Tabs
Use the Tab width spin box to specify the width of the space that xed
inserts when you press the Tab key.
Select the Insert spaces instead of tabs option to specify that xed
inserts spaces instead of a tab character when you press the Tab key.

soft tabs showing up as hard tabs, spaces converted to hard tabs

I have soft tabs enabled, but not only is the editor putting actual tabs in instead of spaces, if I type [space][space], it converts it to a tab. I've read that the editor tries to read existing files to guess your settings (I have Autodetect turned off if that matters), so I tried with a new file. Here is the relevant section of my settings file (which I edited through the GUI):
"ace": {
"#guessTabSize": false,
"#newLineMode": "unix",
"#tabSize": 2,
"#useSoftTabs": true
},
When I turn off soft tabs, it stops converting spaces into tabs, but either way, when I hit enter at the end of a line, autoindent uses a tab instead of spaces.
Cloud9 doesn't have any code that can convert two spaces into a tab.
When soft tabs is enabled it moves cursor as if two spaces is a tab, but that doesn't change characters in the file.
Enter at the end of line copies indentation from that line, and doesn't depend on tab settings.

Sublime text, right click on file and it automatically opens, but I want to delete the file. Why?

Sublime text, right click on file and it automatically opens, problem is I want to delete the file. Why?
You can change this behavior by opening Preferences -> Settings-User and adding the following:
"preview_on_click": false
If the file is empty, make sure you wrap the settings in curly braces { }. If there are multiple settings, make sure there is a comma , after each line except the last one.
When you set this to false, you will need to double-click on files in the sidebar to open them.

Vertical split of cshtml window in VS2013

In VS2013 I want to view the same cshtml file in 2 windows side by side (i.e. vertical split). I know how to do a horizontal split but that's not what I'm after here.
The usual approach is to duplicate the tab (WINDOW, New Window) for the file and then create a new vertical tab group.
However, I cannot find a way to duplicate a cshtml tab, since the New Window menu item is disabled for that file type.
It works fine for .cs and even .js files.
I tried to assign a key combo for Window.NewWindow, but it still won't work for cshtml files.
Any suggestions?
To enable "New Window" for cshtml you can change "Single Code Window Only" from 1 to 0 in the registry key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Languages\Language Services\HTMLX.
It was probably disabled for a reason and changing 12.0_Config is prone to overwrites on next VS update, but you can try how it works.

Textmate 2 indentation with Python

When I indent by tabbing "Tab" key, the tab is replaced by 4 spaces. Does anyone know how could I set it to normal?
At the bottom of the editor window there is a menu for tab size, you can set the desired width there as well as turning on soft tabs which inserts spaces instead of tabs but treats them as tabs when editing. Your choice will be saved based on the active file type so make sure to set it when in a python file.

Resources