editor-rs / vscode-rust

Rust for Visual Studio Code
MIT License
475 stars 62 forks source link

Show diagnostics in RLS mode #261

Open rnewman opened 7 years ago

rnewman commented 7 years ago

I figured I'd file issues that would block me using RLS mode.

RLS mode doesn't show any compile errors inline in the source.

The justification for this is:

Executing a cargo command doesn't show any diagnostics (unlike Legacy Mode).

It is intentional design decision.

The reason is that there is no pretty way to hide a diagnostic after the diagnostic's cause is fixed.

That (the showing of a problem which has been already fixed) may confuse people, hence the decision.

I don't think this reasoning is valid: legacy mode also leaves diagnostics in the editor until you rebuild. Indeed, this is true for most languages.

The inability to show compile errors in the source is a huge limiting factor for a language plugin.

rnewman commented 7 years ago

I note that currently I don't see errors in the source or in the "Problems" drawer. They appear only in the RLS output:

[Error - 10:00:18 AM] Request textDocument/definition failed.
  Message: GotoDef failed to complete successfully
  Code: -32601 
{"message":"no associated item named `Re` found for type `mentat_core::ValueType` in the current scope","code":{"code":"E0599","explanation":"\n```compile_fail,E0599\nstruct Mouth;\n\nlet x = Mouth;\nx.chocolate(); // error: no method named `chocolate` found for type `Mouth`\n               //        in the current scope\n```\n"},"level":"error","spans":[{"file_name":"query-algebrizer/src/types.rs","byte_start":25915,"byte_end":25928,"line_start":535,"line_end":535,"column_start":39,"column_end":52,"is_primary":true,"text":[{"text":"        ValueTypeSet(EnumSet::of_both(ValueType::Re, ValueType::Long))","highlight_start":39,"highlight_end":52}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}
{"message":"aborting due to previous error(s)","code":null,"level":"error","spans":[],"children":[],"rendered":null}
thread '<unnamed>' panicked at 'could not run cargo: build failed', src/libcore/result.rs:860
note: Run with `RUST_BACKTRACE=1` for a backtrace.
KalitaAlexey commented 7 years ago

It's interesting. I'm sorry. I haven't time for a while.

KalitaAlexey commented 7 years ago

@rnewman, Could you provide the following information please:

rnewman commented 7 years ago

Same details as #262. I don't believe this depends on the project, but I will experiment with a clean setup and a minimal project on Monday.