Loading ...
Sorry, an error occurred while loading the content.

How to deal with multiple compiler error formats, possibly from a single make invocation?

Expand Messages
  • Sam Roberts
    Hi, using node, mocha, and jshint, when I run my unit tests with make, I can get output from any of the above. All with different error formats. Note that I
    Message 1 of 4 , May 23, 2013
    • 0 Attachment
      Hi, using node, mocha, and jshint, when I run my unit tests with make,
      I can get output from any of the above. All with different error
      formats. Note that I can run lint seperate from mocha, but mocha is a
      test runner, it WILL have node error stacks in its output, and I want
      to be able to :cn through them.

      I can see how I might combine all their error formats by hand into one
      massive "javascript" error format, by cutting and pasting, but I don't
      see how I could do this in anything like a nice way.

      I'd like something like:

      after/javascript.vim:
      compiler jshint
      compiler +node
      compiler +mocha

      Baring that, is there some way I could map \\ to make, \j to [set
      makeprg=npm run lint, \\], \n to [set makeprg=node %, \\], etc...

      Suggestions, please?


      The errformats lying around the web for the above are all poorly
      constructed, instead of being constructed as a compiler, they are
      hard-coded into javascript.vim file types, often with the authors
      idiosyncratic makeprg preferences, as well, so I'm reconstructing them
      as compiler definitions. :-(

      If anybody has a decent vim setup for node.js development, I'd love to
      hear about it.

      Sam

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Ben Fritz
      ... Maybe instead you could use :caddfile, :caddbuffer, or :caddexpr to build a list using one format at a time? -- -- You received this message from the
      Message 2 of 4 , May 23, 2013
      • 0 Attachment
        On Thursday, May 23, 2013 4:46:05 PM UTC-5, Sam Roberts wrote:
        > Hi, using node, mocha, and jshint, when I run my unit tests with make,
        >
        > I can get output from any of the above. All with different error
        >
        > formats. Note that I can run lint seperate from mocha, but mocha is a
        >
        > test runner, it WILL have node error stacks in its output, and I want
        >
        > to be able to :cn through them.
        >
        >
        >
        > I can see how I might combine all their error formats by hand into one
        >
        > massive "javascript" error format, by cutting and pasting, but I don't
        >
        > see how I could do this in anything like a nice way.
        >
        >
        >
        > I'd like something like:
        >
        >
        >
        > after/javascript.vim:
        >
        > compiler jshint
        >
        > compiler +node
        >
        > compiler +mocha
        >

        Maybe instead you could use :caddfile, :caddbuffer, or :caddexpr to build a list using one format at a time?

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Sam Roberts
        ... Can you give me more of a hint? Somehow, I d have to create a macro that ran make, then called compiler X, caddfile, compiler Y, caddfile, etc....? Sam --
        Message 3 of 4 , May 23, 2013
        • 0 Attachment
          On Thu, May 23, 2013 at 6:32 PM, Ben Fritz <fritzophrenic@...> wrote:
          > On Thursday, May 23, 2013 4:46:05 PM UTC-5, Sam Roberts wrote:
          >> I'd like something like:
          >>
          >> after/javascript.vim:
          >> compiler jshint
          >> compiler +node
          >> compiler +mocha
          >
          > Maybe instead you could use :caddfile, :caddbuffer, or :caddexpr to build a list using one format at a time?

          Can you give me more of a hint?

          Somehow, I'd have to create a macro that ran make, then called
          compiler X, caddfile, compiler Y, caddfile, etc....?

          Sam

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Ben Fritz
          ... I don t have a specific example, but yes, that s what I had in mind. Or better, a function called by a command. When I made the suggestion, I thought you
          Message 4 of 4 , May 24, 2013
          • 0 Attachment
            On Thursday, May 23, 2013 11:51:43 PM UTC-5, Sam Roberts wrote:
            > On Thu, May 23, 2013 at 6:32 PM, Ben Fritz <fritzophrenic@...> wrote:
            >
            > > On Thursday, May 23, 2013 4:46:05 PM UTC-5, Sam Roberts wrote:
            >
            > >> I'd like something like:
            >
            > >>
            >
            > >> after/javascript.vim:
            >
            > >> compiler jshint
            >
            > >> compiler +node
            >
            > >> compiler +mocha
            >
            > >
            >
            > > Maybe instead you could use :caddfile, :caddbuffer, or :caddexpr to build a list using one format at a time?
            >
            >
            >
            > Can you give me more of a hint?
            >
            >
            >
            > Somehow, I'd have to create a macro that ran make, then called
            >
            > compiler X, caddfile, compiler Y, caddfile, etc....?
            >

            I don't have a specific example, but yes, that's what I had in mind. Or better, a function called by a command.

            When I made the suggestion, I thought you could get each compiler's output separately. Then it would be easy. But since all your compilers output to a single file, you'll probably actually need something like:

            function ParseEverything()
            lines=readfile(compiler_output_file)
            call writefile(filter(copy(lines), 'v:val =~ ''pattern_to_match_compiler_x'''), compiler_x_output_file)
            compiler X
            caddfile compiler_x_output_file
            " etc.
            endfunction

            So, maybe combining the errorformats is easier.

            Alternatively, you could write a function or program to transform all the outputs into a common errorformat. In the Vim repository, runtime/tools has a ccfilter tool to do this for some compilers, you might look into that one.

            --
            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          Your message has been successfully submitted and would be delivered to recipients shortly.