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

ElixirLS do-completion inserts wrong indentation #6255

Closed
leonqadirie opened this issue Mar 10, 2023 · 2 comments · Fixed by #6263
Closed

ElixirLS do-completion inserts wrong indentation #6255

leonqadirie opened this issue Mar 10, 2023 · 2 comments · Fixed by #6263
Assignees
Labels
C-bug Category: This is a bug

Comments

@leonqadirie
Copy link
Contributor

Summary

Following the discussions in #5864 and #6224 - completing Elixir's do still messes up indentation on my end, originating from ElixirLS returning offsets without completions.

Reproduction Steps

I tried this:

  1. hx
  2. Navigate to any .ex file
  3. Enter def test do
  4. Apply the do completion

I expected this to happen:

def test do
  |
end

Instead, this happened:

def test do
           |
         end

Helix log

No response

Platform

macOS

Terminal Emulator

Kitty/Alacritty

Helix Version

22.12-383-g98415f28

@leonqadirie leonqadirie added the C-bug Category: This is a bug label Mar 10, 2023
@pascalkuthe
Copy link
Member

pascalkuthe commented Mar 10, 2023

this actually... seems kind of correct given how the code was intended. Snippets are generated so newlines are indented to match the start position (which is before do here). However now I tested in vscode and it seems vscode doesn't behave the same.
It seems VScode uses the indentation at the start of the line rather the start of the snippet from my experimentation. This makes sense to me. In that case snippet lines would just act like pressing enter normally would in helix.

In that case we should use TS based indent queries here.

I will try to find out how exactly vscode handles this first

@pascalkuthe
Copy link
Member

Fixing this was quite easy, I posed #6263. My comment about TS was rubbish, just needed to keep the indentation of the current line (VScode does the same so LS expect that and will add additional indentation themselves)

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

Successfully merging a pull request may close this issue.

2 participants