Open ALSchwalm opened 7 years ago
Hmmm. I'm not sure there is any value in implementing this as a user selectable operational mode. In normal shell use the current verbose output should be used. If the -compileonly
option is used it probably makes more sense to always use JSON as shown in the opening comment to facilitate integrating that output into other tools.
@xiaq mentioned in #458 that it would be a good idea to allow different error formats, and I agree. I wanted to go ahead and make an issue for this to get some details worked out before doing any implementation. I see a few possible options for format:
Running
elvish somefile.elv
on a file with contents$test
would produce the following errors in each format:pretty: The current format:
Compilation error: variable $test not found somefile.elv, line 1: $test
short: A format similar to those used by other major languages:
somefile.elv:1:1: error: variable $test not found
JSON: maybe something like:
{ type : "compilation error", message: "variable $test not found" position: { file: "somefile.elv", start: { line: 1, column: 1 }, end: { line: 1, column: 6 } }
I think no format should produce multiple errors in one output. So the current "multiple parse errors in ..." would instead use multiple lines. I'm also expressing things in terms of line-column because I think that is much more common than start-end file position.
Thoughts?