Skip to content

Conversation

@coot
Copy link
Contributor

@coot coot commented Aug 5, 2017

Indent function declaration correctly (no indent)

f :: String -> String
f

but indent if it's a type declaration

f :: String
  -> String

Marcin Szamotulski added 2 commits August 5, 2017 07:03
Indent function declaration correctly (no indent)
```
f :: String -> String
f
```
but indent if it's a type declaration
```
f :: String
  -> String
```
```
  where f :: String -> String
```
Previously `f` was highlighted as an identifier, while if not on a line
with where (or let) it is wrapped inside a `purescriptFunctionDecl` and
highlighted in the same way as type signature.
@coot
Copy link
Contributor Author

coot commented Aug 5, 2017

And also fix a small syntax highlighting issue.

@coot coot changed the title indentation: fix a corner cases WIP indentation: fix a corner cases Aug 5, 2017
```
  where x :: Int
	x = 0
```
and
```
  let y :: Boolean
      y = false
```

The purescriptFunctionDecl group has to finish on the second line.  In
order to acomplish that provide two additional `purescriptFunctionDecl`
syntax region declarations.

This is fixes the regression introduced in the previous commit where
`purescriptFunctionDecl` extended over whole `where` / `let` blocks.
@coot coot changed the title WIP indentation: fix a corner cases indentation: fix a corner cases Aug 5, 2017
@coot
Copy link
Contributor Author

coot commented Aug 5, 2017

@Arthur-Xavier could you test the syntax highlighting for type declarations in let and where clauses. Hopefully there is no regression anywhere else. Modifying vim syntax is always tricky :/

Marcin Szamotulski added 5 commits August 5, 2017 21:12
Instead shift intendation on next line.
Do that consistently for `}` and `]`.
```
newtype MInt = MInt Int
  -- this line will be indent but if empty and one presses <C-M> the next line will not
```
So tyyping `<C-M>` twice will reset indentation.  This works for any
declaration starting in the first colum, but still one can have indentent
code if one starts a multi line declaration.
@coot coot changed the title indentation: fix a corner cases indentation: fix some issues Aug 6, 2017
remove `g:` (it's not necessary)
@arthurxavierx arthurxavierx merged commit 8e84790 into purescript-contrib:master Aug 7, 2017
@arthurxavierx
Copy link
Collaborator

Sorry for the late response; I had a really busy weekend and needed some spare time to look into this. Seems all right to me, couldn't detect any regressions. I tested against lots of source files both the syntax and the indent definitions (I lost my SyntaxTest.purs… Should've put it in the repo I guess).

I noticed, however, a few problems with class, instance declarations and arrow operators (both type and term-level). I checked but these problems didn't come with any of your changes and they also didn't happen before. The color scheme I use also had no updates on PureScript syntax. I guess it must be a Vim thing or I don't know. Anyway, I'll file some issues and see if I can work on them later; or you if you'd like to.

Thanks for the help! :)

@coot
Copy link
Contributor Author

coot commented Aug 7, 2017

That ok, i had time to catch all kinks.

Do you mean some problems with highlighting? I haven't followed vim dev closely, so it's hard to say.

@arthurxavierx
Copy link
Collaborator

Yes. The one I'm sure there wasn't before is where arrow operators (<- and -> both in type- and term-level) aren't getting highlighted. There was one with multiparameter type classes I had to fix but didn't create an issue and another one in instance heads of which I'm not sure it happened before.

@coot coot deleted the indentation branch August 19, 2017 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants