Skip to content

Add errorformat #74

Open
Open

Description

@johnridesabike

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.

Activity

  1. johnridesabike commented on Jan 3, 2024

    @johnridesabike
    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions