oderwat / vscode-indent-rainbow

Extension which shows indentation with a faint rainbow colored background to make them more readable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

indent-rainbow interacts weirdly with python indentation

Sorontik opened this issue · comments

I have a size-4-tab-indented python-file.
I use the default python extensions ms-python.python, ms-python.debugpy and ms-python.vscode-pylance

The error does not occur with other languages like markdown or json.

the error:

If indent-rainbow is active and i create a new line from an indented line, the new line is indented with spaces instead of tabs and the result is immediately marked in the error-color by indent rainbow.
E.g.: the first line is indented with 3 Tabs, then i press enter and the new line is indented with 3 spaces

expected behaviour:

If i disable rainbow-indent (without changing anything else) and create another new line, the error no longer occurs and the new line is indented with tabs as expected.

environment:

I have changed the following settings

"indentRainbow.lightIndicatorStyleLineWidth": 3,
"indentRainbow.tabmixColor": "rgba(200,32,30,0.8)",
"editor.guides.indentation": false,
"indentRainbow.colors": [

// alpha default 0.7

// "rgba(255,255,64,0.07)",	// yellow
// "rgba(127,255,127,0.07)",	// light green
// "rgba(255,127,255,0.07)",	// pink
// "rgba(79,236,236,0.07)",	// light blue


"rgba(255,255,64,0.15)", // alpha def 0.7
"rgba(127,255,127,0.15)",
"rgba(255,127,255,0.15)",
"rgba(79,236,236,0.15)",

],
"indentRainbow.indicatorStyle": "light",

I'm not sure how vs-code and the python extensions interact exactly, but i have set the following indentation-related settings, which work as expected if indent-rainbow is deactivated.

"editor.insertSpaces": false,
"editor.detectIndentation": false,
"[python]": {
    "editor.formatOnType": true,
    "editor.autoIndent": "advanced"
},

Unfortunately, i couldn't find any relevant logs from indent-rainbow to attach here.

The plugin does not change the source code and does not change how the editor works with indentation. Having over 7 million installs, I never heard of this problem.

Can you give me hints, how i can dive deeper into this and find out more about what's going on?

The error occurs only when indent-rainbow is enabled, so it has to be related somehow...

The error is that there are suddenly spaces instead of tabs.
And you say this only happens if you enable the plugin.
Right?

I quickly modified my settings to your setup and can't reproduce the problem. I personally never use tabs and have a very small settings.json though.

You could try to go back to a very basic settings and extensions setup. In the past there were problems that only happened when other extensions were present. You may want to switch of anything but python and indent-rainbow.

Are you on the Microsoft "Visual Studio Code"? There were problems with VSCodium releases in the past, which I generally do not want to support.

Sadly, I have no idea on how to get deeper into that problem.