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

Wrong automatic indentation after trailing operators #5

Open
michalmuskala opened this issue Feb 18, 2022 · 1 comment
Open

Wrong automatic indentation after trailing operators #5

michalmuskala opened this issue Feb 18, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@michalmuskala
Copy link
Contributor

michalmuskala commented Feb 18, 2022

Describe the bug
Given the code below:

function() ->
    expr() andalso
        expr().

pressing enter indents the cursor by 8 spaces to align with the final expr().. We end up with:

function() ->
    expr() andalso
        expr().

        |

This is also visible when pasting some code after similar function. For example, manually removing the extra indentation, and then pasting function2() -> ok. ends up with:

function() ->
    expr() andalso
        expr().

    function2() -> ok.

In this case the final indentation is only 4 spaces, rather than the 8 spaces produced by simply pressing enter.

Expected behavior
The indentation should be reset to the left margin given we're outside any function.

Context

  • erlang_ls version (tag/sha): v0.0.32 of the VS Code extension
@michalmuskala michalmuskala added the bug Something isn't working label Feb 18, 2022
@robertoaloi robertoaloi transferred this issue from erlang-ls/erlang_ls Feb 20, 2022
@michalmuskala
Copy link
Contributor Author

As a follow up. There's wrong un-indentation after case as well:

case test of
    test ->
        test|

with return:

case test of
    test ->
        test
        |

after typing end, it gets de-dented, but only by one level, leaving the indentation still incorrect:

case test of
    test ->
        test
    end|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant