Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Improve error output - multiline errors #11

Open
seanhess opened this issue Mar 6, 2015 · 6 comments
Open

Improve error output - multiline errors #11

seanhess opened this issue Mar 6, 2015 · 6 comments

Comments

@seanhess
Copy link

seanhess commented Mar 6, 2015

The error output is really hard to read. Specifically, errors usually span 3 lines, and vim-flow currently identifies the 3rd line as another error, when it is extra information about the current error.

Could we indent that 3rd line and not have it appear as another error?

I would also suggest remove the || between lines.

For a great example to follow, see this typescript plugin: https://github.com/leafgarland/typescript-vim

@ghost
Copy link

ghost commented Aug 4, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

@brentvatne
Copy link

I made a couple of changes to my local setup to make this a bit nicer...

Before:

After:

In plugin/flow.vim I changed flow_errorformat to this:

let s:flow_errorformat = '%AFile "%f"\, line %l\, characters %c-%.%#,%Z%m,'

Only change here is from %E to %A so you don't see "error" in each line (annoying imo)

Then I changed the command to execute flow, appending a pipe into format-flow at the end:

let command = g:flow#flowpath.' --timeout 2 --retry-if-init false --from vim '.expand('%:p').' '.a:suffix . ' | format-flow'

And format-flow is just a really ugly node script that I built in a couple minutes with trial-and-error and it sits in my path:

#!/usr/bin/env node

const fileLine = /^File.*?characters.*?$/;

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(data) {
  let lines = data.split('\n');
  let result = '';
  let lastLineWasFileLine = false;

  lines.forEach((line, i) => {
    if (line.match(fileLine)) {
      lastLineWasFileLine = true;
      if (i > 0) {
        process.stdout.write('\n');
      }
      process.stdout.write(line);
      process.stdout.write('\n');
    } else {
      if (!lastLineWasFileLine) {
        if (line) {
          process.stdout.write(' - ' + line);
        }
      } else {
        process.stdout.write(line);
      }
      lastLineWasFileLine = false;
    }
  });
});

@danihodovic
Copy link

I have a proof of concept hack that uses JSON to construct error messages so that the error messages in the quickfix list don't span multiple lines. See https://github.com/danihodovic/vim-flow/tree/fix-error-format or specifically danihodovic@0d6870e.

flow-formatting

@rafaelrinaldi
Copy link

rafaelrinaldi commented Dec 20, 2016

Why not exposing flow_errorformat globally so users don't have to come up with ad-hoc workarounds in order to change it?

Current output format is indeed very bad to read.

We might even be able to take advantage of great work already done out there such as flow-vim-quickfix.

@hashar
Copy link

hashar commented Jan 25, 2017

@danihodovic approach of using flow --json. His Format_json_error_msg is straightforward. Though in the patch flow is invoked via system instead of FlowClientCall, but that looks promising.

@andykais
Copy link

andykais commented Jun 5, 2017

has there been any progress on this? This issue is still open so are any core members working on it?

datadeflator added a commit to datadeflator/dotfiles that referenced this issue Aug 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants