This repository has been archived by the owner on Dec 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added linting to the documentation. (#92)
- Loading branch information
1 parent
285d532
commit 067efc3
Showing
11 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.