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

Implemented improved Python indent function. #1736

Closed
wants to merge 1 commit into from

Conversation

funk443
Copy link
Contributor

@funk443 funk443 commented Jan 5, 2025

The new indent function for Python mimics the behaviour of indent function as seen in Emacs, where hitting tab key will cycle through the following positions:

  • Same indent level as last line.
  • +1 indent level relative to last line.
  • -1 indent level relative to last line.

There're still a flaw in this function, that I currently have no idea how to fix:

#        v cursor
foo = bar|

after newline-and-indent:

foo = bar
    |
#   ^ it should not have indented, since it's just a top-level
#     assignment, not a `def` or `class`.

The new indent function for Python mimics the behaviour of indent function
as seen in Emacs, where hiting tab key will cycle through the following
positions:

- Same indent level as last line.
- +1 indent level relative to last line.
- -1 indent level relative to last line.

There're still a flaw in this function, that I currently have no idea
how to fix:

```python
foo = bar|
```

after `newline-and-indent`:

```python
foo = bar
    |
    ^ it should not have indented, since it's just a top-level
      assignment, not a `def` or `class`.
```
@funk443 funk443 closed this Jan 5, 2025
@funk443 funk443 deleted the contrib branch January 5, 2025 17:53
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

Successfully merging this pull request may close these issues.

1 participant