-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
253: Fix diagnostic fixes showing up everywhere r=matklad a=flodiebold The LSP code action request always returned the fixes for all diagnostics anywhere in the file, because of a shadowed variable. There's no test yet; I wasn't sure where to add it. I tried adding one in `heavy_tests`, but that's a bit uncomfortable because the code action response contains the (random) file paths. I could make it work, but wanted to ask beforehand what you think. 256: Improve/add use_item documentation r=matklad a=DJMcNab Adds some documentation to use_item explaining all code paths (use imports are hard, especially with the ongoing discussion of anchored v. uniform paths - see rust-lang/rust#55618 for what appears to be the latest developments) Co-authored-by: Florian Diebold <flodiebold@gmail.com> Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
- Loading branch information
Showing
12 changed files
with
541 additions
and
3 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,8 @@ | ||
use ::crate_name; // Rust 2018 - All flavours | ||
use crate_name; // Rust 2018 - Anchored paths | ||
use item_in_scope_or_crate_name; // Rust 2018 - Uniform Paths | ||
|
||
use self::module::Item; | ||
use crate::Item; | ||
use self::some::Struct; | ||
use crate_name::some_item; |
105 changes: 105 additions & 0 deletions
105
crates/ra_syntax/tests/data/parser/inline/0114_use_path.txt
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,105 @@ | ||
SOURCE_FILE@[0; 247) | ||
USE_ITEM@[0; 17) | ||
USE_KW@[0; 3) | ||
WHITESPACE@[3; 4) | ||
USE_TREE@[4; 16) | ||
PATH@[4; 16) | ||
PATH_SEGMENT@[4; 16) | ||
COLONCOLON@[4; 6) | ||
NAME_REF@[6; 16) | ||
IDENT@[6; 16) "crate_name" | ||
SEMI@[16; 17) | ||
WHITESPACE@[17; 18) | ||
COMMENT@[18; 45) | ||
WHITESPACE@[45; 46) | ||
USE_ITEM@[46; 61) | ||
USE_KW@[46; 49) | ||
WHITESPACE@[49; 50) | ||
USE_TREE@[50; 60) | ||
PATH@[50; 60) | ||
PATH_SEGMENT@[50; 60) | ||
NAME_REF@[50; 60) | ||
IDENT@[50; 60) "crate_name" | ||
SEMI@[60; 61) | ||
WHITESPACE@[61; 62) | ||
COMMENT@[62; 91) | ||
WHITESPACE@[91; 92) | ||
USE_ITEM@[92; 124) | ||
USE_KW@[92; 95) | ||
WHITESPACE@[95; 96) | ||
USE_TREE@[96; 123) | ||
PATH@[96; 123) | ||
PATH_SEGMENT@[96; 123) | ||
NAME_REF@[96; 123) | ||
IDENT@[96; 123) "item_in_scope_or_crate_name" | ||
SEMI@[123; 124) | ||
WHITESPACE@[124; 125) | ||
COMMENT@[125; 153) | ||
WHITESPACE@[153; 155) | ||
USE_ITEM@[155; 178) | ||
USE_KW@[155; 158) | ||
WHITESPACE@[158; 159) | ||
USE_TREE@[159; 177) | ||
PATH@[159; 177) | ||
PATH@[159; 171) | ||
PATH@[159; 163) | ||
PATH_SEGMENT@[159; 163) | ||
SELF_KW@[159; 163) | ||
COLONCOLON@[163; 165) | ||
PATH_SEGMENT@[165; 171) | ||
NAME_REF@[165; 171) | ||
IDENT@[165; 171) "module" | ||
COLONCOLON@[171; 173) | ||
PATH_SEGMENT@[173; 177) | ||
NAME_REF@[173; 177) | ||
IDENT@[173; 177) "Item" | ||
SEMI@[177; 178) | ||
WHITESPACE@[178; 179) | ||
USE_ITEM@[179; 195) | ||
USE_KW@[179; 182) | ||
WHITESPACE@[182; 183) | ||
USE_TREE@[183; 194) | ||
PATH@[183; 194) | ||
PATH@[183; 188) | ||
PATH_SEGMENT@[183; 188) | ||
CRATE_KW@[183; 188) | ||
COLONCOLON@[188; 190) | ||
PATH_SEGMENT@[190; 194) | ||
NAME_REF@[190; 194) | ||
IDENT@[190; 194) "Item" | ||
SEMI@[194; 195) | ||
WHITESPACE@[195; 196) | ||
USE_ITEM@[196; 219) | ||
USE_KW@[196; 199) | ||
WHITESPACE@[199; 200) | ||
USE_TREE@[200; 218) | ||
PATH@[200; 218) | ||
PATH@[200; 210) | ||
PATH@[200; 204) | ||
PATH_SEGMENT@[200; 204) | ||
SELF_KW@[200; 204) | ||
COLONCOLON@[204; 206) | ||
PATH_SEGMENT@[206; 210) | ||
NAME_REF@[206; 210) | ||
IDENT@[206; 210) "some" | ||
COLONCOLON@[210; 212) | ||
PATH_SEGMENT@[212; 218) | ||
NAME_REF@[212; 218) | ||
IDENT@[212; 218) "Struct" | ||
SEMI@[218; 219) | ||
WHITESPACE@[219; 220) | ||
USE_ITEM@[220; 246) | ||
USE_KW@[220; 223) | ||
WHITESPACE@[223; 224) | ||
USE_TREE@[224; 245) | ||
PATH@[224; 245) | ||
PATH@[224; 234) | ||
PATH_SEGMENT@[224; 234) | ||
NAME_REF@[224; 234) | ||
IDENT@[224; 234) "crate_name" | ||
COLONCOLON@[234; 236) | ||
PATH_SEGMENT@[236; 245) | ||
NAME_REF@[236; 245) | ||
IDENT@[236; 245) "some_item" | ||
SEMI@[245; 246) | ||
WHITESPACE@[246; 247) |
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,7 @@ | ||
use some::path as some_name; | ||
use some::{ | ||
other::path as some_other_name, | ||
different::path as different_name, | ||
yet::another::path, | ||
running::out::of::synonyms::for::different::* | ||
}; |
124 changes: 124 additions & 0 deletions
124
crates/ra_syntax/tests/data/parser/inline/0115_use_alias.txt
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,124 @@ | ||
SOURCE_FILE@[0; 181) | ||
USE_ITEM@[0; 28) | ||
USE_KW@[0; 3) | ||
WHITESPACE@[3; 4) | ||
USE_TREE@[4; 27) | ||
PATH@[4; 14) | ||
PATH@[4; 8) | ||
PATH_SEGMENT@[4; 8) | ||
NAME_REF@[4; 8) | ||
IDENT@[4; 8) "some" | ||
COLONCOLON@[8; 10) | ||
PATH_SEGMENT@[10; 14) | ||
NAME_REF@[10; 14) | ||
IDENT@[10; 14) "path" | ||
WHITESPACE@[14; 15) | ||
ALIAS@[15; 27) | ||
AS_KW@[15; 17) | ||
WHITESPACE@[17; 18) | ||
NAME@[18; 27) | ||
IDENT@[18; 27) "some_name" | ||
SEMI@[27; 28) | ||
WHITESPACE@[28; 29) | ||
USE_ITEM@[29; 180) | ||
USE_KW@[29; 32) | ||
WHITESPACE@[32; 33) | ||
USE_TREE@[33; 179) | ||
PATH@[33; 37) | ||
PATH_SEGMENT@[33; 37) | ||
NAME_REF@[33; 37) | ||
IDENT@[33; 37) "some" | ||
COLONCOLON@[37; 39) | ||
USE_TREE_LIST@[39; 179) | ||
L_CURLY@[39; 40) | ||
WHITESPACE@[40; 42) | ||
USE_TREE@[42; 72) | ||
PATH@[42; 53) | ||
PATH@[42; 47) | ||
PATH_SEGMENT@[42; 47) | ||
NAME_REF@[42; 47) | ||
IDENT@[42; 47) "other" | ||
COLONCOLON@[47; 49) | ||
PATH_SEGMENT@[49; 53) | ||
NAME_REF@[49; 53) | ||
IDENT@[49; 53) "path" | ||
WHITESPACE@[53; 54) | ||
ALIAS@[54; 72) | ||
AS_KW@[54; 56) | ||
WHITESPACE@[56; 57) | ||
NAME@[57; 72) | ||
IDENT@[57; 72) "some_other_name" | ||
COMMA@[72; 73) | ||
WHITESPACE@[73; 75) | ||
USE_TREE@[75; 108) | ||
PATH@[75; 90) | ||
PATH@[75; 84) | ||
PATH_SEGMENT@[75; 84) | ||
NAME_REF@[75; 84) | ||
IDENT@[75; 84) "different" | ||
COLONCOLON@[84; 86) | ||
PATH_SEGMENT@[86; 90) | ||
NAME_REF@[86; 90) | ||
IDENT@[86; 90) "path" | ||
WHITESPACE@[90; 91) | ||
ALIAS@[91; 108) | ||
AS_KW@[91; 93) | ||
WHITESPACE@[93; 94) | ||
NAME@[94; 108) | ||
IDENT@[94; 108) "different_name" | ||
COMMA@[108; 109) | ||
WHITESPACE@[109; 111) | ||
USE_TREE@[111; 129) | ||
PATH@[111; 129) | ||
PATH@[111; 123) | ||
PATH@[111; 114) | ||
PATH_SEGMENT@[111; 114) | ||
NAME_REF@[111; 114) | ||
IDENT@[111; 114) "yet" | ||
COLONCOLON@[114; 116) | ||
PATH_SEGMENT@[116; 123) | ||
NAME_REF@[116; 123) | ||
IDENT@[116; 123) "another" | ||
COLONCOLON@[123; 125) | ||
PATH_SEGMENT@[125; 129) | ||
NAME_REF@[125; 129) | ||
IDENT@[125; 129) "path" | ||
COMMA@[129; 130) | ||
WHITESPACE@[130; 132) | ||
USE_TREE@[132; 177) | ||
PATH@[132; 174) | ||
PATH@[132; 163) | ||
PATH@[132; 158) | ||
PATH@[132; 148) | ||
PATH@[132; 144) | ||
PATH@[132; 139) | ||
PATH_SEGMENT@[132; 139) | ||
NAME_REF@[132; 139) | ||
IDENT@[132; 139) "running" | ||
COLONCOLON@[139; 141) | ||
PATH_SEGMENT@[141; 144) | ||
NAME_REF@[141; 144) | ||
IDENT@[141; 144) "out" | ||
COLONCOLON@[144; 146) | ||
PATH_SEGMENT@[146; 148) | ||
NAME_REF@[146; 148) | ||
IDENT@[146; 148) "of" | ||
COLONCOLON@[148; 150) | ||
PATH_SEGMENT@[150; 158) | ||
NAME_REF@[150; 158) | ||
IDENT@[150; 158) "synonyms" | ||
COLONCOLON@[158; 160) | ||
err: `expected identifier` | ||
PATH_SEGMENT@[160; 163) | ||
ERROR@[160; 163) | ||
FOR_KW@[160; 163) | ||
COLONCOLON@[163; 165) | ||
PATH_SEGMENT@[165; 174) | ||
NAME_REF@[165; 174) | ||
IDENT@[165; 174) "different" | ||
COLONCOLON@[174; 176) | ||
STAR@[176; 177) | ||
WHITESPACE@[177; 178) | ||
R_CURLY@[178; 179) | ||
SEMI@[179; 180) | ||
WHITESPACE@[180; 181) |
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,4 @@ | ||
use *; | ||
use ::*; | ||
use some::path::{*}; | ||
use some::path::{::*}; |
Oops, something went wrong.