-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Added Purescript language and Pulp syntax checker #1531
base: master
Are you sure you want to change the base?
Conversation
This has been tested by other community members now too. |
This is great! 👍 I believe it does need some work, though:
|
Aside from the issues pointed out by @sharkdp, let errorformat =
\ '%E%\s%#psc: %m,' .
\ '%C%\s%#at "%f" (line %l\, column %c)%.%#,' .
\ '%E%\s%#"%f" (line %l\, column %c)%.%#,' .
\ '%E%.%#Error at %f line %l\, column %c - %.%#,'.
\ '%-G%\%# ERROR: Subcommand%.%#,' .
\ '%\%# ERROR: %m,' .
\ '%-G%\s%#See http%.%#,' .
\ '%C%\s%#%m' I'd suggest the following framework for testing let &errorformat = '...'
lgetexpr [
\ 'Error found:',
\ 'Error at /home/lcd047/tmp/purs/src/Main.purs line 5, column 4 - line 5, column 4:',
\ ' Unable to parse module:',
\ ' unexpected ]',
\ ' expecting binder, \| or =',
\ 'See https://github.com/purescript/purescript/wiki/Error-Code-ErrorParsingModule for more information, or to contribute content related to this error.'
\ ]
echomsg string(getloclist(0))
lopen |
@sharkdp: I'm new to Purescript,
There's no way to display multiple lines in syntastic errors that I am aware of. @lcd047 is that correct? Is there another way you'd like to see that error on one line? It seems readable to me. How can I generate an orphan instance? |
@lcd047 That's super useful thanks! It's such a pain to test the errorformat on a real project. You are getting syntax errors in the current errorformat? How can I see them? I definitely generated some earlier while developing it, but I don't see any now and it appears to work. I'm happy to fix them but it would be difficult without being able to reproduce them. |
@lcd047 I'm not seeing any errors with my errorformat even using your testing method. Can you help me reproduce the problem? Thanks! |
It depends on what you mean by that. Loclist windows don't display multiline text fields as multiple lines. That's a limitation of Vim, not syntastic. But you can join messages spread across multiple lines, and format them to look reasonable.
Like I said, I haven't run that in Vim. But some of the constructs you're using don't work the way you seem to expect. Anyway, looking at the list of possible errors, I don't think you stand any chance to cover them all with a reasonable effort. Not with |
Doing nothing - if pulp is not available - is fine. In general though, using pulp as a syntax checker does feel wrong to me:
Probably not, since pulp is just a wrapper around
It's actually not straightforward because we have to include all of the projects purescript and javascript files. This is where using pulp comes in handy. Alternatively, I was thinking it would be really nice to have something like hlint for purescript. This could potentially be much faster than a full build of the project (?). I realize that I'm just piling up ideas here... that's not very helpful, sorry.
If it's possible to concat these lines with some whitespace in between, that would be great.
There is an example on the purescript wiki here. When using all of this code in a single file, your syntastic checker actually works nicely (correctly indicating the orphan instance error). So ignore my comment above, this is not due to the error formating. However, when I split this code into separate modules |
There is no way to run the compiler without generating output files right now, at least not using the standard executables. An option could be added easily though and I'd happily take a PR to add a Since the compiler accepts globs now, it might be easier to use |
@paf31 As far as I'm concerned building the project while checking is annoying, but not fatal. Other checkers do that, and people still use them. The real show stopper however is having to parse error messages from 100+ ad-hoc formats. It would be nice if |
That's been requested before. I can prioritize it now that proper editor support is becoming a thing. Is there a best format I can use? |
@paf31 Something like One more thing: column numbers should be counted as byte offsets from the beginning of line (1 tab = 1 character). Otherwise, the exact positions of the errors depend on tab size... |
Do we want to try to push for something we can merge short-term, or wait until you make changes to psc @paf31? We're probably going to end up using Elm for our project so I would prefer to get this to a useful state, get it merged, and let you guys make PRs to it as you improve things. |
@seanhess The current code has various problems, and the changes kindly offered by @paf31 would make a big difference. If you need a checker right now, perhaps you can maintain it externally until the relevant features are added to |
@lcd047 It's already useful. While there are many diverse errors the vast majority fall within the same formats. I would rather clean up the things you mentioned (the errorformat issues) and get this merged while we wait so people can use it. But I'm ok either way. I would like to do whatever is more helpful to the Purescript community. |
@seanhess Sadly, useful to you != problem-free for me. Missing errors is a great source of bug reports, and a legitimate one at that. shrug |
I totally understand. Well I'll defer to you of course. If you want to wait |
I've tested with as many different kinds of errors I can generate, and it appears to be useful. Please let me know if there's anything you'd like me to change.