Skip to content

Treesitter indent currently broken for Python #78

Description

@g2boojum

Describe the bug
Out of the box right now, using Treesitter's indentation w/ Python is broken. I've changed the treesitter config to read:
indent = { enable = true; disable = { "python" } }
which is not ideal, but breaking indentation for new users might be worse?

To Reproduce
Steps to reproduce the behavior:

  1. Open a python file w/ nvim. Open a line after a "def xxxx" line, and watch nvim not indent properly.

Desktop (please complete the following information):

  • OS: Linux
  • Terminal: kitty

** Neovim Version **

  • Output of running :version from inside of neovim:
    0.8.1

Activity

tjdevries commented on Dec 20, 2022

@tjdevries
Member

good call, i just disabled it cause it was really bad haha

g2boojum commented on Jun 7, 2023

@g2boojum
Author

Looks like this was finally fixed in March (nvim-treesitter/nvim-treesitter#2947), so python indenting in tree-sitter no longer needs to be disabled.

added a commit that references this issue on Dec 10, 2023
d44acfb
added a commit that references this issue on Jan 27, 2024
aa660e6
added a commit that references this issue on Sep 3, 2024
7ccb42d
added a commit that references this issue on Oct 30, 2024
9bb56ea
added a commit that references this issue on Dec 19, 2024
096e51b
added a commit that references this issue on Mar 16, 2025
506af53

amirmohammaddivani commented on Jun 12, 2025

@amirmohammaddivani

I have it disabled now in 2025. Because it's really bad in writing methods in classes especially when the return keyword is used. It's really difficult when you want to write multiple methods inside a class that return something.

added a commit that references this issue on Jun 19, 2025
53c0512
added a commit that references this issue on Aug 5, 2025
762522c
added a commit that references this issue on Mar 17, 2026
a68492b
added a commit that references this issue on Oct 2, 2026
4ce82e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions