elm.vim icon indicating copy to clipboard operation
elm.vim copied to clipboard

Problem with indentation

Open nyorem opened this issue 9 years ago • 7 comments

Hello, It seems that there is an issue regarding the indentation.

Consider the following snippet, the cursor is represented by '^':

foo =
    bar
    ^

Then if I press backspace, I get the following:

foo =
bar
   ^

The position of the cursor seems to be wrong.

nyorem avatar Mar 01 '15 09:03 nyorem

tl;dr I hear you, and am also currently working on this problem

I've also been dissatisfied with the indent file in this plugin (even though I'm the one who sent the PR for it in the first place!), and have been trying various other Haskell indent plugins. So far they all suck for Elm (auto-indenting will break Elm programs), and are proving difficult to adapt.

So... I'm starting to think that it might be easier to adapt an existing Python indent plugin to work for Elm. Python suffers for the same reasons (contextually significant whitespace) as Haskell, but since there are more Python users in the world their tools might be a bit better.

hoosierEE avatar May 09 '15 00:05 hoosierEE

Also since Elm demands 4-space indentation, maybe the plugin should make vim do that automatically?

spinningarrow avatar Aug 28 '15 05:08 spinningarrow

Is 4-space indentation an official thing? I've been away from Elm (and this plugin) for a while now; sorry to have dropped the ball. But if 4-space indentation is not semantic, then the user's shiftwidth setting should be used. 4-spaces as a default should be fine though.

hoosierEE avatar Aug 28 '15 23:08 hoosierEE

I realised I was referring to this gist which is not official. On the other hand, I was originally using tabs for indentation which were definitely giving me whitespace errors from the compiler.

I guess it's not an official thing then.

—Sahil

On Sat, Aug 29, 2015 at 7:21 AM, Alex Shroyer [email protected] wrote:

Is 4-space indentation an official thing? I've been away from Elm (and this plugin) for a while now; sorry to have dropped the ball. But if 4-space indentation is not semantic, then the user's shiftwidth setting should be used. 4-spaces as a default should be fine though.

— Reply to this email directly or view it on GitHub https://github.com/lambdatoast/elm.vim/issues/19#issuecomment-135911183.

spinningarrow avatar Aug 30 '15 06:08 spinningarrow

Until this is fixed, deleting the indentation folder works for me.

talon avatar Nov 24 '15 21:11 talon

4 spaces is idiomatic (and enforced by elm-format) but not semantic.

gilesbowkett avatar Nov 14 '16 15:11 gilesbowkett

creact-elm-app starting file Main.elm is 4 spaces too btw.

quangv avatar Oct 04 '17 06:10 quangv