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

Commit

Permalink
Added linting to the documentation. (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
KalitaAlexey authored Feb 20, 2017
1 parent 285d532 commit 067efc3
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 8 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

# Rust for Visual Studio Code (Latest: 0.3.7)

## Why the fork?
## What is the repository?

RustyCode is no longer maintained and the developer seems to have lost all interest in the extension. Due to no response from the original author, this fork was created which now contains additional features and many bug fixes.
The extension is continuation of RustyCode (an extension for Visual Studio Code for Rust language).

RustyCode is no longer maintained and the developer seems to have lost all interest in the extension. Due to no response from the original author, this repository was created which now contains additional features and many bug fixes.

## Extension

Expand Down
2 changes: 1 addition & 1 deletion doc/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The extension supports formatting the document opened in the active text editor on saving.

If the extension is runnning in [RLS Mode](rls_mode.md), formatting is performed via `rustfmt` integrated into RLS.
If the extension is runnning in [RLS Mode](rls_mode/main.md), formatting is performed via `rustfmt` integrated into RLS.

If the extension is running in [Legacy Mode](legacy_mode/main.md), formatting is performed via separate `rustfmt`.

Expand Down
29 changes: 29 additions & 0 deletions doc/legacy_mode/linting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Linting In Legacy Mode

Executing a cargo command makes the extension parse the the command's output and show diagnostics.

Legacy Mode cannot show diagnostics as you type, for that you should use [RLS Mode](../rls_mode/linting.md).

Let's assume we have the following code:

```rust
fn main() {
let x = 5 + "10";
}
```

We then execute any cargo command. Let's execute ["Cargo: Build"](../cargo_command_execution.md).

It builds and shows diagnostics:

* In the source code:

[![Linting](../../images/linting/code.jpg)]()

* And In the Problems panel:

[![Linting](../../images/linting/problems_panel_legacy_mode.jpg)]()

We can hover over any diagnostic to see what it is:

[![Linting](../../images/linting/code_hover_legacy_mode.jpg)]()
23 changes: 23 additions & 0 deletions doc/linting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Linting Page

The extension provides linting as shown in the following screenshot:

[![Linting](../images/linting/code.jpg)]()

It also populates the Problems panel.

For the code:

```rust
fn foo(i: i32) {}

fn main() {
foo(2i64);
}
```

The Problems panel would look like:

[![Linting](../images/linting/problems_panel.jpg)]()

Linting behaves differently in [RLS Mode](rls_mode/linting.md) than in [Legacy Mode](legacy_mode/linting.md).
11 changes: 6 additions & 5 deletions doc/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ The documentation describes features supported by the extension.
The extension can function in one of two modes:

* [Legacy Mode](legacy_mode/main.md)
* [Rust Language Server Mode](rls_mode.md)
* [Rust Language Server Mode](rls_mode/main.md)

Each mode is described in detail on its own page.

Furthermore, the extension allows:
Furthermore, the extension provides:

* [To execute one of built-in cargo command](cargo_command_execution.md)
* [To create a playground](playground_creation.md)
* [To format a document opened in the active text editor](format.md)
* [Linting (the showing of diagnostics in the active text editor)](linting.md)
* [Executing one of built-in cargo command](cargo_command_execution.md)
* [Creating a playground](playground_creation.md)
* [Formatting a document opened in the active text editor](format.md)

Also it provides snippets and keybindings.

Expand Down
15 changes: 15 additions & 0 deletions doc/rls_mode/linting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Linting in Rust Language Server Mode

RLS checks the project and shows diagnostics while you are typing.

You can see diagnostics in the Problems panel.

You can hover over a diagnostic to see what the problem is.

Executing a cargo command doesn't show any diagnostics (unlike [Legacy Mode](../legacy_mode/linting.md)).

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.
File renamed without changes.
Binary file added images/linting/code.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/linting/code_hover_legacy_mode.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/linting/problems_panel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/linting/problems_panel_legacy_mode.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 067efc3

Please sign in to comment.