atom-ocaml / ocaml-merlin

Linting and autocompletion for Ocaml in Atom
MIT License
24 stars 3 forks source link

Line break in the error messages #27

Closed Kakadu closed 7 years ago

Kakadu commented 7 years ago

When merlin reports an error (which takes more then 1 line) all line breaks are gone in the tooltip (which is wrong) and also are gone from all issues list (which is probably right). Maybe we need to replace \\n to \n in the incoming merlin messages?

This is a sample merlin multiline answer straced by me:

...
write(1, "[\"return\",[{\"start\":{\"line\":131,\"col\":32},\"end\":{\"line\":131,\"col\":40},\"type\":\"type\",\"sub\":[],\"valid\":true,\"message\":\"This expression has type Nat.ground -> string\\n       but an expression was expected of type Nat.ground list -> string\\n       Type Nat.gro"..., 469) = 469
...
Kakadu commented 7 years ago

I'm afraid that it is only semi-solution because be default only first line is shown in the tooltip and in the error list. We need to press an arrow manually to show the rest of error message. Can we automatically expand tooltips?

314eter commented 7 years ago

That's the reason I previously removed all whitespace from error messages. The tooltips are create by linter, so I can't change that.

Kakadu commented 7 years ago

Maybe @steelbrain knows right workaround?

steelbrain commented 7 years ago

@Kakadu is correct, linter supports multi-line-messages, you just have to separate the lines with \n in your message.

314eter commented 7 years ago

That's what I'm doing now, but I think @Kadaku doesn't like that only the first line is shown before clicking on the arrow.

Kakadu commented 7 years ago

It will be great if tooltip will autoexpand after hanging for a couple of seconds... @steelbrain, is it possible?

Kakadu commented 7 years ago

Pieter, after release of linter 2.0 can we do something with error tooltips? At the moment it shows only the word Warning in a tooltip and I need to use mouse to see the whole text. Also CSS is pretty bad, IMHO. screenshot

314eter commented 7 years ago

I know it's not ideal, but I changed it to preserve indentation in multiline messages. multiline

Kakadu commented 7 years ago

Also I see expanded text of the error message in a dark color but your variant is better. Any idea why it can happen?

314eter commented 7 years ago

The colors are chosen by your theme. You can change them in your local styles.less file:

#linter-tooltip pre {
  background-color: rgba(0, 0, 0, 0.1);
}
mehcode commented 7 years ago

@314eter @Kakadu Check out https://atom.io/packages/linter-ui-plus ( upcoming rewrite of the UI of linter ). There are no tooltips (yet) but the extended description is shown nicely in the panel.

Kakadu commented 7 years ago

@mehcode Looks good. Please continue!