Is tab-switching a feature in VSCode? - visual-studio-code

By this I mean if some file was written with 4 spaces, can you simply highlight it all and click on something to turn it into 2 spaces. I'm not sure if in practice (parsing) this would make sense/could lead to broken code.
I currently have my editor.tabSize set to 2, and sometimes I open files written with 4 spaces and I want to be able to turn them into 2 spaces. I have at least figured out to turn off the auto-detect so that when I highlight sections of the code and hit shift-tab, then tab again it will turn the selected code from 4 spaces into 2 spaces.
Is there a feature like this or does it make sense that this wouldn't exist?

To change the current document from using 4 spaces to 2 spaces:
Click on Spaces: 4 in the status bar or run the Indent using Spaces command
Select 2 for the new tab size
Run for Format Document command to apply the new indentation to the entire document

Related

vscode - for file type, make tab always just make 4 spaces

From my understanding, vscode's default tab behavior is to tab to the next column that is divisible by your tab length. So if my tab length is 4 and I am at column 1, it will add 3 spaces. Great!
For a certain file type, I would like to override this behavior and have tab always make exactly 4 spaces, rather than taking me to the next divisible column. How can I do this?
VScode currently spaces the cursor to column 5 from column 1. So it is adding 4 spaces to wherever you hit the tab key. I just typed a comment line like so
1234567890 and in the line under that I hit the tab key and the curson went to space 5 and space 9. So it appears to be doing what you want. I haven't set anything. In the settings file you can see the following description.
// The number of spaces a tab is equal to. This setting is overridden based on the file contents when editor.detectIndentation is on.
"editor.tabSize": 4,

indeneted files in my sublime don't show up indented correctly on github files

I have indented my files in my sublime text but when I push to github they don't look indented. How do I fix this?
The approach taken to indent file on sublime is:
select the code > Edit > Line > Reindent
looks like this on github:
Your issue looks to be caused by your use of literal tab characters for indenting as opposed to using spaces instead.
If there's a hotter holy war topic among developers than the debate of tabs versus spaces, it's probably related to how wide you should interpret a tab character to be for display purposes if you happen to use them.
In particular your images would appear to indicate that you think that tabs should be 2 characters wide and GitHub thinks they should be 8. As mentioned in this answer you can append an extra query field to the URL in GitHub in order to view the files the way you prefer them to be viewed.
As far as I'm aware that just changes how they're rendered on the page when you view and doesn't actually modify the file at all. If it's important that the file retain the same indent levels regardless of where or how you view the file, you should convert from tab indentation to space indentation instead since a space is unambiguously sized.
If you're using Sublime Text you can do that by clicking in the status bar where it says Tab Size: 2 and select Convert indentation to spaces; the status bar will switch to say Spaces: 2 to indicate that the indent has changed.

Is possible to display 4 spaces characters as 2 in VSCode?

I am working for company using 4 spaces to indent codebase,
but I am used to 2 spaces, and it's kinda annoying to get eyes used to switch between such different projects.
Is there some way how to make 4 spaces (on the beginning of lines) to look like 2 ? Without any modification of code.
I am using VS Code editor.
This is not possible. A workaround (best practice) would be to replace each 4 spaces with a single TAB, then each user can just customize his own tab display width.

Number of spaces in Tab - OpenEdge

In OpenEdge the tab can be configured to any number of spaces, usually is configured to 4 spaces.
To insert a tab in a text can be used: ~t.
What I want to find is how many spaces have the tab set.
For example, I am reading a file line by line, and for each line I want to see how many spaces are at the beginning.
I am using:
iNoOfBeginningSpaces = index (cLine, left-trim (cLine)) - 1.
But if the line begins with 3 tabs then it gives me 3, and not the number of the spaces: 3 * spaces from tab.
Is there a way to find the number of beginning spaces of a line, treating the tab as x numbers of spaces?
No. Spaces and tabs are not the same thing. You are getting confused by the fact that programming editors, word processors and printers convert tabs to spaces to get to tab stops. But in a data file no such conversion occurs (unless you are saving the file from an editor that does such conversions).
I will tell you how to check in your AppBuilder.
On the AppBuilder Menu you go to OPTIONS and then EDITING OPTIONS and there you can set how much "spaces" the editor uses for Tabs and Syntax indents. But this is basically for DISPLAY purposes within APPBUILDER.
Tom has given you the correct technical answer, a tab is a type of control character that can be interpreted differently by different apps. It has a different value than spaces.Below you can see the value of space and Horizontal Tab.
Char Oct Dec Hex Control-Key Control Action
HT 11 9 9 ^I Horizontal tab, move to next tab stop
=============================================
Char Octal Dec Hex Description
SP 40 32 20 Space

tinymce removes extra spaces

I have a text area tinymce file that removes extra spaces and I don't want that.
For example if in the text area if I put hello, 5 spaces, bye, and when I save the file and view it again, 4 spaces are deleted and I see hello bye. (4 extra spaces are deleted)
Sorry if I sound not too informed about this, but I just wonder if this is a default feature or if there is an easy way to turn off this feature. (I do not want the extra spaces to be deleted.)
Thanks,
The issue here is that modern browsers will not display several spaces - but will show them as one single space. The solution here is to replace every second space with a " " before the content gets into the editor (best is to replace them on serverside). This way the browser will show all the spaces.