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

Formatting depends on both file and buffer content #1419

Open
namedots opened this issue Feb 2, 2023 · 0 comments
Open

Formatting depends on both file and buffer content #1419

namedots opened this issue Feb 2, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@namedots
Copy link

namedots commented Feb 2, 2023

It seems to me like content is read from the buffer, then diffed against the file and then changes are applied to the buffer. But if the file doesn't match the buffer, then applying that diff to the buffer doesn't make sense.
That might not be entirely accurate. That is my rough impression of what's happening.

this is what that looks like: https://asciinema.org/a/ydOkICrct6uhjXTQ3iik5S3cF

-module(hello).


five() -> 5.

this is reproduced by saving the above content (plus a blank line above it which github leaves out) to hello.erl, and repeatedly formatting it. the buffer ends up having this content after having formatted 3 times:

five() ->
five() ->
five() ->
    5.

expected behaviour: format the buffer and ignore the file, formatting again should have no further effect

work-around: save before formatting and only format once, or use other method of formatting

Context

  • erlang_ls version (tag/sha): 0.46.1 / 1a66e87
  • Editor used: nvim
  • LSP client used: coc

same thing with vscode and https://marketplace.visualstudio.com/items?itemName=erlang-ls.erlang-ls

@namedots namedots added the bug Something isn't working label Feb 2, 2023
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