Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indent-rainbow interacts weirdly with python indentation #181

Open
Sorontik opened this issue May 6, 2024 · 3 comments
Open

indent-rainbow interacts weirdly with python indentation #181

Sorontik opened this issue May 6, 2024 · 3 comments

Comments

@Sorontik
Copy link

Sorontik commented May 6, 2024

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.

@oderwat
Copy link
Owner

oderwat commented May 6, 2024

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.

@Sorontik
Copy link
Author

Sorontik commented May 6, 2024

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...

@oderwat
Copy link
Owner

oderwat commented May 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants