Sublime Forum

[Solved] Sublime tabs do not show properly

#1

Here’s how my code looks like in st3 (the indentation is weird)

Here’s how it looks like in Eclipse


Here’s how it looks like on Github

I am wondering what’s wrong. The only tab related setting I know that I’m using are
34

So I am wondering what happened lol
Just in case, here’s my user setting for st3:

Feel free to let me know what you think! Also, if you have any suggestion for my current setting, please comment below.

Thank you for your time!

-------- UPDATE - August 17th, 2019 --------

So, whats the issue?

The issue was caused by Eclipse’s code formatter which uses tabs under certain behavior.
As @OdatNurd mentioned in his reply, tab size in ST is 4, which caused the situation at line 32 (which uses tab)

Solution

I reformatted my code with another formatter profile which does not use tabs.

Reflection

Not using tab in your code is a good practice. Yes, do not use tabs. Replace them with spaces. Cuz the code representation may vary based under different editor settings. (attached are before and after comparison)

Thanks to @wbond for the debugging tip.
Thanks to @bschaaf for the first respond! I really appreciate it ^0^

Before (dot means space, long dash means tab)

After

0 Likes

#2

Could you paste the code into the forums (or provide a link to the repo if it’s public) so that we can try to reproduce the issue?

0 Likes

#3

My hunch would be mixed tabs and spaces combined with a different tab_size in Sublime Text. If you add the following setting to your Preferences, it will draw the whitespace, which would help identify such an issue:

    "draw_white_space": "all",
3 Likes

#4

repo will be https://github.com/zhongjis/keyword_search_engine_xlsm. Thank you!

0 Likes

#5


hmmmm. looks like tab only occurs to appear as 4 spaces…

0 Likes

#6

Based on that, it seems like perhaps the tab size in the other editors is 8; so the tab there appears as 8 spaces wide, indenting the return statement there. In Sublime where the tab size is set to 4, the tab appears as 4, so it’s no longer visually indented.

0 Likes

#8

got it. thank you! going to update the post for solution.

0 Likes