Commit graph

388 commits

Author SHA1 Message Date
Shotaro Yamada
474a04615c Skip attrs in Literal::token 2019-06-15 23:36:12 +09:00
Muhammad Mominul Huque
f032eeb05f
Get rid of failure: ra_batch ra_cli 2019-06-15 13:24:02 +06:00
csmoe
2ca9f71897 fix: support existential type 2019-06-12 14:32:39 +00:00
Andrey Tkachenko
281c9eeaff [#1083] Try block syntax 2019-06-06 15:43:26 +04:00
csmoe
44363cd5d2 fix: clean up warnings
Change-Id: I91a468f6e846ac28574825b8ee7aa02fbff68f63
2019-06-06 10:06:46 +08:00
Alan Du
b28ca32db2 Fix clippy::or_fun_call 2019-06-04 18:05:07 -04:00
Alan Du
ed3d93b875 Fix clippy::single_char_pattern 2019-06-04 18:05:07 -04:00
Aleksey Kladov
38cb88307e flip Into to From 2019-05-29 10:31:07 +03:00
Aleksey Kladov
2e722ec54b show error offsets in tests 2019-05-29 10:31:07 +03:00
Aleksey Kladov
0efbcdf435 remove old parsing methods 2019-05-28 17:34:28 +03:00
Aleksey Kladov
310bfe57bd update test data 2019-05-28 17:09:45 +03:00
Aleksey Kladov
bc2550b196 update tests 2019-05-28 16:59:22 +03:00
Aleksey Kladov
afeaea7051 drop error from SOurceFile constructor 2019-05-28 16:34:23 +03:00
Aleksey Kladov
1cece9f219 return errors from tree builder 2019-05-28 16:26:14 +03:00
Aleksey Kladov
90926b9479 drop errors from SyntaxNode 2019-05-28 16:15:17 +03:00
Aleksey Kladov
f52eda675e add Parse 2019-05-28 16:15:17 +03:00
Pascal Hertleif
1e6ba19015 Make rainbows optional 2019-05-27 11:44:46 +02:00
Pascal Hertleif
43d5a49653
More clever highlighting, incl draft for structs 2019-05-27 11:26:35 +02:00
Pascal Hertleif
ed89b0638b
Hash based on binding name and shadow counter 2019-05-27 11:26:35 +02:00
Pascal Hertleif
5bf3e949e8
Semantic highlighting spike
Very simple approach: For each identifier, set the hash of the range
where it's defined as its 'id' and use it in the VSCode extension to
generate unique colors.

Thus, the generated colors are per-file. They are also quite fragile,
and I'm not entirely sure why. Looks like we need to make sure the
same ranges aren't overwritten by a later request?
2019-05-27 11:26:33 +02:00
Edwin Cheng
fcb1eef323 Change TokenSource to iteration based 2019-05-25 20:41:03 +08:00
Aleksey Kladov
765f93b8d8 add is_union to structs AST 2019-05-21 01:15:56 +03:00
Aleksey Kladov
e29a58995b ⬆️ text_unit 2019-05-15 19:19:05 +03:00
Sergey Parilin
993abedd77 apply T! macro where it is possible 2019-05-15 15:35:47 +03:00
Aleksey Kladov
549728bba8 make AstId untyped 2019-05-13 19:39:06 +03:00
bors[bot]
033a32f349 Merge #1257
1257: Implemented tkn! macro for syntax kinds r=matklad a=pasa

Implementation of #1248

Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-05-13 13:49:14 +00:00
Sergey Parilin
57bb618fd3 Implemented T! macro for syntax kinds 2019-05-13 15:19:57 +03:00
Florian Diebold
d6dc75f9f2 Handle auto traits & negative impls
We don't pass field types to Chalk yet though, so the auto trait inference won't
be correct.
2019-05-11 16:21:20 +02:00
Aleksey Kladov
313314e14b share literal validation logic with compiler 2019-05-07 19:41:59 +03:00
Sergey Parilin
26ed925685 fill struct fields diagnostic 2019-05-06 17:16:11 +03:00
bors[bot]
aa7bdfd37f Merge #1208
1208: [WIP] Goto for Macro's r=matklad a=Lapz

Adds goto definition for macros. Currently only works for macros in the current crate ~~otherwise it panics~~. Proper macro resolution needs to be added for it to resolve macros in other crates.

Todo
- [X] Allow goto from macro calls
- [X] Fix panics
- [x] Add tests



![Screen Recording 2019-04-25 at 18 00 24](https://user-images.githubusercontent.com/19998186/56754499-1dd01c00-6785-11e9-9e9a-1e36de70cfa3.gif)



Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-05-04 18:38:10 +00:00
Lenard Pratt
8198e13c26 Added local macro goto 2019-05-04 17:39:51 +01:00
Aleksey Kladov
8876f44054 Revert "eagarly clean astd maps"
This reverts commit 6c63a59425.

This causes massive slowdowns: looks like we accidentally have some source-depndent
2019-05-04 16:04:34 +03:00
Aleksey Kladov
6c63a59425 eagarly clean astd maps 2019-05-04 11:53:44 +03:00
Edwin Cheng
9e4fee8b41 Add default type param in TypeParam Node 2019-05-03 12:18:35 +08:00
bors[bot]
6618d1edc3 Merge #1213
1213: Make lexer produce only single character puncts r=matklad a=edwin0cheng

As discussed in Zulip, this PR change `lexer` to produce only single char punct.

* Remove producing `DOTDOTDOT, DOTDOTEQ, DOTDOT, COLONCOLON, EQEQ, FAT_ARROW, NEQ, THIN_ARROW` in lexer.
* Add required code in parser to make sure everythings works fine.
* Change some tests (Mainly because the `ast::token_tree` is different)

Note: i think the use of `COLON` in rust is too overloaded :)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-28 16:51:02 +00:00
Edwin Cheng
d436ab0581 Refactor parser handle mult-char punct internally 2019-04-28 23:46:03 +08:00
Florian Diebold
85633656df Fix hover on the beginning of a nested expression
E.g. in
```
let foo = 1u32;
if true {
   <|>foo;
}
```
the hover shows `()`, the type of the whole if expression, instead of the more
sensible `u32`. The reason for this was that the search for an expression was
slightly left-biased: When on the edge between two tokens, it first looked at
all ancestors of the left token and then of the right token. Instead merge the
ancestors in ascending order, so that we get the smaller of the two possible
expressions.
2019-04-28 16:03:49 +02:00
Aleksey Kladov
268e739c94 move add_missing_members to structured editing API
Currently, this is more code, and we also loose auto-indenting of
bodies, but, long-term, this is the right approach
2019-04-22 13:01:33 +03:00
Aleksey Kladov
97f41d7343 test short structs 2019-04-22 00:52:21 +03:00
Aleksey Kladov
7cc845e88d start structured editing API 2019-04-21 20:51:20 +03:00
bors[bot]
4ad2e4ce4e Merge #1154
1154: Initial support for lang items (and str completion) r=flodiebold a=marcogroppo

This PR adds partial support for lang items.
For now, the only supported lang items are the ones that target an impl block.

Lang items are now resolved during type inference - this means that `str` completion now works.

Fixes #1139.

(thanks Florian Diebold for the help!)


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-04-20 16:13:50 +00:00
Marco Groppo
e85ee60c42 Initial support for lang items. 2019-04-20 00:10:19 +02:00
Edwin Cheng
3ff5440a50 Add MacroItems and MacroStmts in grammer.ron 2019-04-19 02:47:29 +08:00
bors[bot]
5d35f284f5 Merge #1138
1138: Add L_DOLLAR and R_DOLLAR r=matklad a=edwin0cheng

As discussion in issue https://github.com/rust-analyzer/rust-analyzer/issues/1132 and PR #1125 , this PR add 2 `Syntax::Kind` : `L_DOLLAR` and `R_DOLLAR` for representing `Delimiter::None` in mbe and proc_marco. By design, It should not affect the final syntax tree, and will be discard in `TreeSink`.

My original idea is handling these 2 tokens case by case, but i found that they will appear in every place in the parser (imagine `tt` matcher). So this PR only handle it in `Parser::do_bump` and `Parser::start`, although It will not fix the `expr` matcher executing order problem in original idea.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-14 14:16:42 +00:00
Robin Freyler
6aae0cf7fa
replace usages of algo::generate with iter::successors from std 2019-04-13 16:43:49 +02:00
Edwin Cheng
74e846b9ec Add L_DOLLAR and R_DOLLAR 2019-04-11 11:02:41 +08:00
Aleksey Kladov
faf526e021 migrate to untyped rowan 2019-04-09 10:26:51 +03:00
Lenard Pratt
b27fa33a9f updated snapshots 2019-04-07 13:23:18 +01:00
Lenard Pratt
e175921932 Added ArrayExprKind,
changed the  display for fixed array types,
Added Array Enum to ra_hir/expr
2019-04-07 13:23:14 +01:00