rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 94 forks source link

Automatically strips trailing spaces even when not saving #459

Closed hasrthur closed 5 years ago

hasrthur commented 5 years ago

Hi,

I noticed some strange behavior after I installed the plugin. Whenever I try to edit a line and start with a space char and I am not fast enough the space character will be stripped. These are my settings:

Screen Shot 2019-08-01 at 20 08 20

To overcome the issue I have to do this (which is not an option really):

Screen Shot 2019-08-01 at 20 11 15

or this:

Screen Shot 2019-08-01 at 20 11 54

Both approaches are not perfect though. When I disable the plugin the space is preserved unless I save the file (which is an expected behavior).

It was reproduced on two machines with macOS Mojave with latest Intellij Idea CE

rikvdkleij commented 5 years ago

Thanks for reporting!

Can you give an example how I can reproduce this issue? Is it only in Haskell files?

hasrthur commented 5 years ago

Steps to reproduce:

  1. Open Intellij Idea with installed plugin

    Screen Shot 2019-08-01 at 21 14 18
  2. Click Create New Project. Choose Haskel module and Project SDK

    Screen Shot 2019-08-01 at 21 14 54
  3. Click Next and choose the name for new project

    Screen Shot 2019-08-01 at 21 16 34
  4. Click Finish and choose Yes when prompted to create a new directory

  5. Wait until all background tasks are finished

  6. Ensure the Strip trailing spaces on save are turned on.

    Screen Shot 2019-08-01 at 21 24 04
  7. Open file src/Lib.hs

  8. Move the cursor to the last line

    Screen Shot 2019-08-01 at 21 21 31
  9. Press space (can repeat multiple times)

  10. Wait couple of seconds.

Actual result: All spaces are deleted

Expected result: All spaces are preserved

hasrthur commented 5 years ago

Is it only in Haskell files?

@rikvdkleij as far as I tested, yes

rikvdkleij commented 5 years ago

Thanks for your report!

Found the issue and fixed it. I did not notice this issue because I had the option Always keep trailing space on caret line enabled.

hasrthur commented 5 years ago

Great news! Thank you!

rikvdkleij commented 5 years ago

Should be solved in beta52.