dense-analysis / dense-analysis/ale
Add support for post-processing of LSP messages
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
Messages which are returned from LSP servers or tsserver can be multi-line messages which are pretty long, and don't look so good when echoed on a single truncated line. One example is a tsserver message for a missing attribute in an object literal. Here's an example from a codebase I work on.
```
Type '{ type: "Text"; min_length: number; max_length: number; }' is not assignable to type 'FormField'.
Type '{ type: "Text"; min_length: number; max_length: number; }' is not assignable to type 'TextField'.
Property 'required' is missing in type '{ type: "Text"; min_length: number; max_length: number;
```
The truncated message I see is something like the following.
```
Type '{ type: "Text"; min_length: number; max_length: number; }' is not assignable to type 'FormField'. Type ...e 'TextField'. Property 'required' is missing in type '{ type: "Text"; min_length: number; max_length: number; }'.
```
It would be nicer to display the last line of output for the short message instead, and reveal the rest with `:ALEDetail`.
```
Property 'required' is missing in type '{ type: "Text"; min_length: number; max_length: number;
```
I propose adding an optional callback to linter definitions for LSP or tsserver linters which receive `(buffer, loclist)` as their input. Then the callback can return a modified `loclist` value. Then it will be possible to generate better message to echo, ignore certain messages, or generally modify the list of problems any way that makes sense.
Contributor guide
Assessment
This issue has not been assessed yet.