-
Notifications
You must be signed in to change notification settings - Fork 83
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
Bad indentation on space #73
Comments
I'm planning to collect examples where the indenter does things one does not expect in this thread. Additionally I'm going to push fixes to the branch |
(I haven't tried the EDIT: Added one more example. |
Thanks a lot, it looks like I didn't handle the pragmas and block comments correctly when checking for nesting. I've pushed another fix on the |
I'm afraid I don't understand the comment indentation example. You start with a somewhat unusual example:
The indenter aligns by looking at the previous line is you indent that it will use that line to do the indentation. Can you describe what kind of effect you would like the have under which circumstances? |
I just tried About the unusual example: In the code base I'm working on we have all kinds of crazy coding styles and things are very inconsistent. We don't have exactly that function, but we have similarly indented comment blocks followed by de-indented code blocks and haskell-vim tries to indent the code blocks in these cases. But I agree that it's unusual and maybe we can just ignore that. |
No problem. Thanks for bringing these issues to my attention. If you find anything or have an idea how we can support more unusual indentation styles without breaking things and without diminishing convenience just let me know. I will leave this issue open for a while just in case you find something else that bothers you :) |
By the way, these changes are now on |
I ran into a similar case: foo =
{ field = bar "("
} ... insert a comma directly below the foo =
{ field = bar "("
,
} ... and it jumps forward, beneath the Is this also covered by the changes you made in |
I have pushed a change onto the indentation branch that should deal with this. Can you check if this fixes your problem and maybe take a shallow look if something else breaks because of this? |
Sure, but I'm (embarrassingly) not exactly sure how to test the changes. I use vundle to manage my vim packages and I don't believe there's any support for pointing at a particular branch/commit hash. It just downloads master/HEAD. |
Doesn't |
Ah, it does. Looks good, thanks! I'll report any other weird behavior I come across. |
I have merged this into |
Another annoying one: foobarlongname = [
blah
, what
,█
^
Cursor here Press space... foobarlongname = [
blah
, what
, █
^
Cursor here Also, it doesn't seem to go away with |
Oh, that's weird... I manually went into my plugin folder and |
This is intended behavior since I'm using comma-first and align them with the enclosing delimiter. |
I'm having issues with indentation as well. Given the following code block: [ (NS spotify spotify (className =? "Spotify") doFullFloat ) ] If I go to the position before the closing ] and do a linebreak and insert a comma I end up with the following code (_ is the cursor): [ (NS spotify spotify (className =? "Spotify") doFullFloat )
,_] Adding a space would now result in the following code: [ (NS spotify spotify (className =? "Spotify") doFullFloat )
, ] Any spaces added anywhere on the line would try and match up the comma with the opening parenthesis on the first line and not the opening bracket which (in my opinion) is the correct and expected behavior. |
This is indeed an interesting specimen… I have to take a closer look at that. |
I'm currently building a test suite for these cases so hopefully this will make the indentation more robust. |
Issue #97 has an additional case where indentation doesn't seem to be working quite right. |
I'm collecting some problems with the indentation here, with examples.
.
. E.g. something like-- | This is a function.
--
will be automatically added. Remove those.In this code:
I want to unpack
y
too, so I move the cursor right beforeInt
and type{-#
. At this point when I add a space the line gets indented like this:(
_
indicates the cursor)The line isn't indented back after the pragma is completely added:
Suppose I have this:
I want to comment-out
line1
andline2
, so I move my cursor to the beginning of line1 and switch to vertical insert mode, selecting thel
column ofline1
andline2
, switching to insert mode withI
and typing--
. Once I insert that last space, things get indented and I get this:This is a bit hard to explain, so I recorded it here https://asciinema.org/a/5h44shozwdzmla82t6a8nqvn2
(more will come here)
The text was updated successfully, but these errors were encountered: