Skip to content

Add errorformat #74

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
johnridesabike opened this issue Dec 30, 2023 · 1 comment
Open

Add errorformat #74

johnridesabike opened this issue Dec 30, 2023 · 1 comment

Comments

@johnridesabike
Copy link

Since the commands like :RescriptBuild were removed, it would be very useful if this included support for Vim's built-in makeprg and errorformat features. I assume makeprg can just be npx rescript $*, but I'm not skilled enough at using errorformat to know what it needs to be.

@johnridesabike
Copy link
Author

After a little bit of trial and error, I have an errorformat that seems to mostly work:

if exists("g:current_compiler")
  finish
endif
let current_compiler = "rescript"

if exists(":CompilerSet") != 2
  command -nargs=* CompilerSet setlocal <args>
endif

CompilerSet makeprg=npx\ rescript\ $*
CompilerSet errorformat=
  \%-GFAILED:%m,
  \%-Grescript:%m,
  \%E\ \ We've\ found\ a\ bug\ for\ you!,
  \%E\ \ Syntax\ error!,
  \%W\ \ Warning\ number\ %n%.%#,
  \%C%f:%l:%c,
  \%C%f:%l:%c-%k,
  \%C%f:%l:%c-%e:%k,
  \%-C\ \ %l\ %.%#,
  \%-C\ \ \ \ %.%#,
  \%-C\\s%#,
  \%-G\\s%#,
  \%C%m,

I'm not confident that it properly handles every error message though, and I've only tested it on ReScript 10. But in case anyone else wants to take a crack at it, this may be a starting point!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant