vim-dispatch-neovim icon indicating copy to clipboard operation
vim-dispatch-neovim copied to clipboard

Quickfix navigation for "Make" does not work

Open fulv opened this issue 7 years ago • 7 comments

I'm still a beginner when it comes to dispatch and this plugin, but I am having a problem with the quickfix window from the Make output. Somehow the error parsing does not work, while it works fine in vim-dispatch if I disable vim-dispatch-neovim. I have created the following test case to reproduce the problem.

Here is my environment:

  • OS: Ubuntu 16.04
  • nvim: v0.2.2
  • vim-dispatch: master branch
  • vim-dispatch-neovim: master branch
  • ~/.vimrc: none
  • ~/.config/nvim/after/compiler/typescript.vim:
let current_compiler = "typescript"
CompilerSet makeprg=tsc\ $*\ --outDir\ build\ %
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
  • ~/.config/nvim/pack/bundle/start: vim-dispatch and vim-dispatch-neovim
  • nothing else at all in ~/.config/nvim
  • nothing in ~/.vim
  • node: v8.11.3
  • npm: 5.6.0
  • tsc: 2.9.2

I have this simple typescript file src/greeting.ts which contains two errors:

class Time {
  constructor(public timestamp: Date) {}

  label() {
    let message: string;
    let hour = this.timestamp.getHours();

    if (hour < 12 && hour > 6) {
      message = 1;
    } else if (hour < 18) {
      message = "afternoon"
    } else if (hour < 21){
      message = "evening"
    } else {
      message = "night"
    }

    return message;
  }
}

function greeting() {
  let now = new Time('now');
  return `Good ${now.label()}`;
}

document.body.innerHTML = greeting();

Then I open this file in nvim, and do the following:

:compiler typescript
:Make

Here is the output in the quickfix window from Make with vim-dispatch-neovim disabled:

src/greeting.ts|9 col 7| src/greeting.ts(9,7): error TS2322: Type '1' is not assignable to type 'string'.                           
src/greeting.ts|23 col 22| src/greeting.ts(23,22): error TS2345: Argument of type '"now"' is not assignable to parameter of type 'Da
te'.

The :cfirst, :cnext, :cprev, :clast commands work fine and position the cursor in the source file accordingly.

By contrast, here it is with vim-dispatch-neovim enabled:

|| src/greeting.ts:9:7 - error TS2322: Type '1' is not assignable to type 'string'.
|| 
|| 9       message = 1;
||         ~~~~~~~
||  
||  
|| src/greeting.ts:23:22 - error TS2345: Argument of type '"now"' is not assignable to parameter of type 'Date'.
||  
|| 23   let now = new Time('now');
||                         ~~~~~
||    
||  
||                     

As you migth imagine, the :cfirst, :cnext, :cprev, :clast commands don't work in the second case. In particular, :cn and :cp simply move forward and backward one line at a time, and do not position the cursor in the source file.

I would be grateful for any insights!

For reference, this example is copied verbatim from the book "Modern Vim", and can be found in every detail in this extract made available to the public by the publisher: https://media.pragprog.com/titles/modvim/failures.pdf

fulv avatar Aug 06 '18 03:08 fulv

Thanks for posting such a detailed issue. I'll look in to this when I get a chance.

nelstrom avatar Aug 09 '18 19:08 nelstrom

FYI: I have the same problem with vim-test when the dispatch strategy is activated, but I think the above test case is cleaner to reproduce the issue and the root cause has to be the same.

fulv avatar Aug 11 '18 20:08 fulv

I have the same problem. BTW this code looks like Tip 10 from Modern Vim.

WloHu avatar Jun 14 '19 06:06 WloHu

@WloHu As I wrote above:

For reference, this example is copied verbatim from the book "Modern Vim", and can be found in every detail in this extract made available to the public by the publisher: https://media.pragprog.com/titles/modvim/failures.pdf

fulv avatar Jun 14 '19 17:06 fulv

Same issue here. Just disable it has worked for me.

hsz1992 avatar Aug 27 '19 03:08 hsz1992

Has anyone found a fix? Just ran into the same problem. Thanks :)

punk-dev-robot avatar Jun 17 '20 16:06 punk-dev-robot

It is caused by colors in output, it would be great if this plugin would strip them from output but here is workaround that fixed it for me: CompilerSet makeprg=tsc\ $*\ --outDir\ build\ --pretty\ false\ %

punk-dev-robot avatar Jun 17 '20 16:06 punk-dev-robot