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

2D array literal indentation #26

Closed
rcorre opened this issue Jun 14, 2015 · 4 comments · Fixed by #29
Closed

2D array literal indentation #26

rcorre opened this issue Jun 14, 2015 · 4 comments · Fixed by #29

Comments

@rcorre
Copy link
Contributor

rcorre commented Jun 14, 2015

The following declaration:

auto a = [
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
];

is indented like so (when using ==):

auto a = [
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
        [ 1, 2, 3, 4 ],
            [ 1, 2, 3, 4 ],
];
@JesseKPhillips
Copy link
Owner

I've been unable to reproduce this, both with and without the indent file installed.

@rcorre
Copy link
Contributor Author

rcorre commented Jun 23, 2015

looks like it only happens inside a block:

unittest {
auto a = [
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
    [ 1, 2, 3, 4 ],
];
}

With the cursor at the top, press =G

@JesseKPhillips
Copy link
Owner

Still not observing this behavior, will need to verify that I am getting the indent file to load.

rcorre added a commit to rcorre/d.vim that referenced this issue Jul 14, 2015
If the current line and the line above both begin with an array literal, align
the current line with the above line.
Resolves JesseKPhillips#26.

Keeps multiline 2D array definitions aligned like so:
auto a = [
  [1, 2, 3],
  [1, 2, 3],
  [1, 2, 3],
];

Previously they were aligned like so:
auto a = [
  [1, 2, 3],
  [1, 2, 3],
    [1, 2, 3],
];
@whitebyte
Copy link
Collaborator

I can reproduce this bug, and suggested solution seems to resolve it. @rcorre mind creating a PR?

rcorre added a commit to rcorre/d.vim that referenced this issue Oct 11, 2015
If the current line and the line above both begin with an array literal, align
the current line with the above line.
Resolves JesseKPhillips#26.

Keeps multiline 2D array definitions aligned like so:
auto a = [
  [1, 2, 3],
  [1, 2, 3],
  [1, 2, 3],
];

Previously they were aligned like so:
auto a = [
  [1, 2, 3],
  [1, 2, 3],
    [1, 2, 3],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants