Skip to content

Support indentation for Utrecht style (prefixed) commas #1091

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

Closed
bergmark opened this issue Jan 17, 2016 · 7 comments
Closed

Support indentation for Utrecht style (prefixed) commas #1091

bergmark opened this issue Jan 17, 2016 · 7 comments

Comments

@bergmark
Copy link

Below, X marks where the caret ends up when i press RET and where I would like different behavior (marked by Y). These examples are only for cases where the position of a new comma is obvious by looking on the previous line.

For all of these I think the most flexible solution would be to indent to the position of the previous comma since that would allow me to insert a comma and a space for a new item, or to close the listing

Pragmas:

{-# LANGUAGE
    Arrows
  , FlexibleContexts<RET>
X

=>

{-# LANGUAGE
    Arrows
  , FlexibleContexts<RET>
  Y

Exports:

module Foo
  ( foo
  , bar<RET>
    X

=>

module Foo
  ( foo
  , bar<RET>
  Y

Expressions:

bar = [ baz
      , bax<RET>
        X

=>

bar = [ baz
      , bax<RET>
      Y

Deriving:

data Foo = Foo
  deriving
    ( Bar
    , Baz<RET>
      X

=>

data Foo = Foo
  deriving
    ( Bar
    , Baz<RET>
      Y
@gracjan
Copy link
Contributor

gracjan commented Jan 21, 2016

Insert comma, press TAB.

We can talk about electric commas.

@geraldus
Copy link
Contributor

@gracjan I always have to do this when work with records, and I find it's quite tedious (:

@gracjan
Copy link
Contributor

gracjan commented Jan 22, 2016

Well, we can talk about electric commas :)

@gracjan
Copy link
Contributor

gracjan commented Feb 4, 2016

Note #1133. @bergmark, I do not know how much time do you have, but would be great if you took a look at #1133 yourself. What do you think?

@fice-t
Copy link
Contributor

fice-t commented Apr 29, 2016

@gracjan Was this recently fixed? It seems that it offers an appropriate indent position now for everything listed in the issue except for the pragma (which doesn't indent at all for me).

@gracjan
Copy link
Contributor

gracjan commented Apr 29, 2016

I used to work for as long as I remember. This functionality was already present in hi2.

I keep this open because LANGUAGE pragma does not indent. At this time we treat language pragma just like every other comment, we just do not do any indentation inside of it.

@gracjan
Copy link
Contributor

gracjan commented May 2, 2016

In general we support comma-first lists, the missing part is to support LANGUAGE pragma indentation, noted in separate issue #1312.

@gracjan gracjan closed this as completed May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants