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 and dedent don't match #3406

Closed
Zoybean opened this issue Aug 13, 2022 · 3 comments
Closed

Indent and dedent don't match #3406

Zoybean opened this issue Aug 13, 2022 · 3 comments
Labels
C-bug Category: This is a bug

Comments

@Zoybean
Copy link
Contributor

Zoybean commented Aug 13, 2022

Summary

In a file with mixed indent amounts, and a language set (I tried with bash an rust, I'm not sure what the exact conditions are), indent amounts do not match dedent amounts.

Reproduction Steps

With the following file open:

test
 file
  with
   mixed
    indents
new line
  1. :set-language bash
  2. ge
  3. <
  4. >>
  5. :set-language rust
  6. <
  7. >>>>

I expected this to happen:

At steps 4 and 7, the indent amount matches the dedent amount in the preceding step

Instead, this happened:

At step 3. the dedent amount is 2 spaces. At step 4, the indent amount is 1 space.
At step 6, the dedent amount is 4 spaces. At step 7, the indent amount is 1 space.

Helix log

n/a

Platform

Windows (WSL: ubuntu)

Terminal Emulator

Windows Terminal Version: 1.14.1962.0

Helix Version

22.05-367-g63ec1095

@Zoybean Zoybean added the C-bug Category: This is a bug label Aug 13, 2022
@AceofSpades5757
Copy link
Contributor

I've had this issue as well, with different languages. Most notably on a pull request branch that's working on Python indentation. So I suspect it's an issue with tree-sitter indent.scm file, but I'm not sure.

@Triton171
Copy link
Contributor

I've seen this bug too but it doesn't have anything to do with the indent.scm queries since those are only used to determine the indentation of a new line. I guess there is a bug somewhere in the indent/unindent functions in helix-term/src/commands.rs. Both functions are pretty short so it might not be too difficult to find it.

@pascalkuthe
Copy link
Member

Closed by #5918, we forgot to link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants