Indentation being underlined and marked in Python

Problem description:
I am coding using Python on my laptop. I don’t expect the device I’m using to be relevant because this happened both on the Replit website and on the desktop app. When I am indenting, in the indented area, it will be underlined in orange, and will say “Indentation contains tabs”. It fixes this problem if I use space instead of tab. This isn’t anything ruining the function of the app. But is quite annoying. Please fix if possible.

Expected behavior:
There should be no underline because there is no issue.

Actual behavior:
Orange underline telling me that I am using tab (which I am) to indent. Very annoying.

Steps to reproduce:
Make some python code where you are required to indent, indent your code using the tab key (not the space bar).

Bug appears at this link:
Use the option to view code. I don’t know if it will show because this is the cover page.

Browser: Chrome
OS: Windows 10 Education
Device (Android, iOS, NA leave blank):
Desktop app version: 1.0.0
Plan (Free, Hacker, Pro Plan): Free

1 Like

Hi @randomcat962, welcome to the forum!
There is an error.

elif (character_length = 4)


elif (character_length == 4)

You need to have the equal to operator (==) and not the assigning operator (=).

After you have fixed that, do tell me what error you encounter!

1 Like

Sorry, this was recently fixed.

1 Like

I will send a screenshot of my screen to show what’s happening. I’m sorry, I probably should’ve done that before.

1 Like

Can you hover over the yellow underline and tell me what you see?

1 Like

Are you by chance using tabs instead of spaces? I think one of the LSP’s newer features is to warn you about using tabs for indentation.

1 Like

When you hover it says “Indentation contains tabs”, with smaller text saying “pyright-extended”. I can send another image if you need.

1 Like

I am using tabs, is that a bad thing?

1 Like

You shouldn’t worry about it, it’s not an error with your code. It’s only a styling tip, ig.
If this answers your question, you can mark this as a Solution.

1 Like

It it possible to hide it? I find it distracting and it makes my code harder to read.

1 Like

You can do what it tells you to do (time-consuming), or turn off LSP (but you won’t have things like auto-complete and not the best syntax highlighting).
Settings > Code Intelligence > off


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.