Skip to content

Follow comma style when arranging a Cabal section #1098

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

Merged
merged 1 commit into from
Jan 21, 2016

Conversation

mrBliss
Copy link
Contributor

@mrBliss mrBliss commented Jan 21, 2016

Addresses #1094: when calling haskell-cabal-subsection-arrange-lines
on a Cabal section, only separate the lines in the section by commas
when the section was already comma-separated. Ignore commas in strings
or comments.

Addresses haskell#1094: when calling `haskell-cabal-subsection-arrange-lines`
on a Cabal section, only separate the lines in the section by commas
when the section was already comma-separated. Ignore commas in strings
or comments.
@geraldus
Copy link
Contributor

@mrBliss 👍

@bergmark
Copy link

🍻

gracjan added a commit that referenced this pull request Jan 21, 2016
Follow comma style when arranging a Cabal section
@gracjan gracjan merged commit 62aafde into haskell:master Jan 21, 2016
mrBliss added a commit to mrBliss/haskell-mode that referenced this pull request Jan 21, 2016
Previously, `haskell-cabal-list-comma-position` was always used when
calling `haskell-cabal-subsection-arrange-lines`.

In haskell#1098, `haskell-cabal-list-comma-position` was respected unless the
no commas were found.

Instead of respecting `haskell-cabal-list-comma-position`, detect the
currently used style and respect it when rearranging the section.

Possible styles:

`before`: a comma at the start of each line (except the first), e.g.
```haskell
    Foo
  , Bar
```

`after`: a comma at the end of each line (except the last), e.g.
```haskell
    Foo,
    Bar
```

`single`: everything on a single line, but comma-separated, e.g.
```haskell
    Foo, Bar
```

`nil`: no commas, e.g.
```haskell
    Foo Bar
```

If the styles are mixed, the position of the first comma determines the
style.
mrBliss added a commit to mrBliss/haskell-mode that referenced this pull request Jan 21, 2016
Previously, `haskell-cabal-list-comma-position' was always used when
calling `haskell-cabal-subsection-arrange-lines'.

In haskell#1098, `haskell-cabal-list-comma-position' was respected unless the
no commas were found.

Instead of respecting `haskell-cabal-list-comma-position', detect the
currently used style and respect it when rearranging the section.

Possible styles:

before: a comma at the start of each line (except the first), e.g.
    Foo
  , Bar

after: a comma at the end of each line (except the last), e.g.
    Foo,
    Bar

single: everything on a single line, but comma-separated, e.g.
    Foo, Bar

nil: no commas, e.g.
    Foo Bar

If the styles are mixed, the position of the first comma determines the
style.
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 this pull request may close these issues.

4 participants