diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 7 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt | 83 | ||||
-rw-r--r-- | editors/code/package.json | 2 | ||||
-rw-r--r-- | editors/code/src/config.ts | 4 |
6 files changed, 98 insertions, 5 deletions
@@ -58,7 +58,7 @@ https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frls-2.2E0 | |||
58 | ## Quick Links | 58 | ## Quick Links |
59 | 59 | ||
60 | * API docs: https://rust-analyzer.github.io/rust-analyzer/ra_ide/ | 60 | * API docs: https://rust-analyzer.github.io/rust-analyzer/ra_ide/ |
61 | 61 | * Website: https://rust-analyzer.github.io/ | |
62 | 62 | ||
63 | ## License | 63 | ## License |
64 | 64 | ||
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index f06191963..09f0a2d98 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -248,7 +248,12 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { | |||
248 | p.error("expected `{`"); | 248 | p.error("expected `{`"); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | expr(p); | 251 | |
252 | if p.at_ts(EXPR_FIRST) { | ||
253 | expr(p); | ||
254 | } else { | ||
255 | p.error("expected expression"); | ||
256 | } | ||
252 | m.complete(p, LAMBDA_EXPR) | 257 | m.complete(p, LAMBDA_EXPR) |
253 | } | 258 | } |
254 | 259 | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs new file mode 100644 index 000000000..a2f74bd87 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn foo() -> i32 { | ||
2 | [1, 2, 3].iter() | ||
3 | .map(|it|) | ||
4 | .max::<i32>(); | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt new file mode 100644 index 000000000..d1544634c --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt | |||
@@ -0,0 +1,83 @@ | |||
1 | SOURCE_FILE@[0; 83) | ||
2 | FN_DEF@[0; 82) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) "(" | ||
9 | R_PAREN@[7; 8) ")" | ||
10 | WHITESPACE@[8; 9) " " | ||
11 | RET_TYPE@[9; 15) | ||
12 | THIN_ARROW@[9; 11) "->" | ||
13 | WHITESPACE@[11; 12) " " | ||
14 | PATH_TYPE@[12; 15) | ||
15 | PATH@[12; 15) | ||
16 | PATH_SEGMENT@[12; 15) | ||
17 | NAME_REF@[12; 15) | ||
18 | IDENT@[12; 15) "i32" | ||
19 | WHITESPACE@[15; 16) " " | ||
20 | BLOCK_EXPR@[16; 82) | ||
21 | BLOCK@[16; 82) | ||
22 | L_CURLY@[16; 17) "{" | ||
23 | WHITESPACE@[17; 22) "\n " | ||
24 | EXPR_STMT@[22; 80) | ||
25 | METHOD_CALL_EXPR@[22; 79) | ||
26 | METHOD_CALL_EXPR@[22; 57) | ||
27 | METHOD_CALL_EXPR@[22; 38) | ||
28 | ARRAY_EXPR@[22; 31) | ||
29 | L_BRACK@[22; 23) "[" | ||
30 | LITERAL@[23; 24) | ||
31 | INT_NUMBER@[23; 24) "1" | ||
32 | COMMA@[24; 25) "," | ||
33 | WHITESPACE@[25; 26) " " | ||
34 | LITERAL@[26; 27) | ||
35 | INT_NUMBER@[26; 27) "2" | ||
36 | COMMA@[27; 28) "," | ||
37 | WHITESPACE@[28; 29) " " | ||
38 | LITERAL@[29; 30) | ||
39 | INT_NUMBER@[29; 30) "3" | ||
40 | R_BRACK@[30; 31) "]" | ||
41 | DOT@[31; 32) "." | ||
42 | NAME_REF@[32; 36) | ||
43 | IDENT@[32; 36) "iter" | ||
44 | ARG_LIST@[36; 38) | ||
45 | L_PAREN@[36; 37) "(" | ||
46 | R_PAREN@[37; 38) ")" | ||
47 | WHITESPACE@[38; 47) "\n " | ||
48 | DOT@[47; 48) "." | ||
49 | NAME_REF@[48; 51) | ||
50 | IDENT@[48; 51) "map" | ||
51 | ARG_LIST@[51; 57) | ||
52 | L_PAREN@[51; 52) "(" | ||
53 | LAMBDA_EXPR@[52; 56) | ||
54 | PARAM_LIST@[52; 56) | ||
55 | PIPE@[52; 53) "|" | ||
56 | PARAM@[53; 55) | ||
57 | BIND_PAT@[53; 55) | ||
58 | NAME@[53; 55) | ||
59 | IDENT@[53; 55) "it" | ||
60 | PIPE@[55; 56) "|" | ||
61 | R_PAREN@[56; 57) ")" | ||
62 | WHITESPACE@[57; 66) "\n " | ||
63 | DOT@[66; 67) "." | ||
64 | NAME_REF@[67; 70) | ||
65 | IDENT@[67; 70) "max" | ||
66 | TYPE_ARG_LIST@[70; 77) | ||
67 | COLONCOLON@[70; 72) "::" | ||
68 | L_ANGLE@[72; 73) "<" | ||
69 | TYPE_ARG@[73; 76) | ||
70 | PATH_TYPE@[73; 76) | ||
71 | PATH@[73; 76) | ||
72 | PATH_SEGMENT@[73; 76) | ||
73 | NAME_REF@[73; 76) | ||
74 | IDENT@[73; 76) "i32" | ||
75 | R_ANGLE@[76; 77) ">" | ||
76 | ARG_LIST@[77; 79) | ||
77 | L_PAREN@[77; 78) "(" | ||
78 | R_PAREN@[78; 79) ")" | ||
79 | SEMI@[79; 80) ";" | ||
80 | WHITESPACE@[80; 81) "\n" | ||
81 | R_CURLY@[81; 82) "}" | ||
82 | WHITESPACE@[82; 83) "\n" | ||
83 | error 56: expected expression | ||
diff --git a/editors/code/package.json b/editors/code/package.json index d6d47e3a1..2e89513e4 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -219,7 +219,7 @@ | |||
219 | }, | 219 | }, |
220 | "rust-analyzer.useClientWatching": { | 220 | "rust-analyzer.useClientWatching": { |
221 | "type": "boolean", | 221 | "type": "boolean", |
222 | "default": false, | 222 | "default": true, |
223 | "description": "client provided file watching instead of notify watching." | 223 | "description": "client provided file watching instead of notify watching." |
224 | }, | 224 | }, |
225 | "rust-analyzer.cargo-watch.arguments": { | 225 | "rust-analyzer.cargo-watch.arguments": { |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index defdfeb9c..df15c8172 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -30,7 +30,7 @@ export class Config { | |||
30 | public displayInlayHints = true; | 30 | public displayInlayHints = true; |
31 | public maxInlayHintLength: null | number = null; | 31 | public maxInlayHintLength: null | number = null; |
32 | public excludeGlobs = []; | 32 | public excludeGlobs = []; |
33 | public useClientWatching = false; | 33 | public useClientWatching = true; |
34 | public featureFlags = {}; | 34 | public featureFlags = {}; |
35 | // for internal use | 35 | // for internal use |
36 | public withSysroot: null | boolean = null; | 36 | public withSysroot: null | boolean = null; |
@@ -148,7 +148,7 @@ export class Config { | |||
148 | this.excludeGlobs = config.get('excludeGlobs') || []; | 148 | this.excludeGlobs = config.get('excludeGlobs') || []; |
149 | } | 149 | } |
150 | if (config.has('useClientWatching')) { | 150 | if (config.has('useClientWatching')) { |
151 | this.useClientWatching = config.get('useClientWatching') || false; | 151 | this.useClientWatching = config.get('useClientWatching') || true; |
152 | } | 152 | } |
153 | if (config.has('featureFlags')) { | 153 | if (config.has('featureFlags')) { |
154 | this.featureFlags = config.get('featureFlags') || {}; | 154 | this.featureFlags = config.get('featureFlags') || {}; |