Commit graph

3797 commits

Author SHA1 Message Date
Edwin Cheng
62ed93db13 Refactor and add more comments 2019-11-08 10:19:41 +08:00
Edwin Cheng
568f3cff41 Fix formatting 2019-11-05 09:43:59 +08:00
Edwin Cheng
2a76bb5a0b Refactor a bit 2019-11-05 03:20:54 +08:00
Edwin Cheng
604bdc6ffe Use macro_rules shift to map text ranges 2019-11-05 02:09:16 +08:00
Edwin Cheng
7e28924012 Use ? and destructing to simplifed long code 2019-11-05 01:38:20 +08:00
Edwin Cheng
e6709f64af Rename and fix typos 2019-11-05 01:38:20 +08:00
Edwin Cheng
d8b7ba201e Add note for recurseive macro generated code 2019-11-05 01:38:20 +08:00
Edwin Cheng
1630a34c3f Add tests 2019-11-05 01:38:20 +08:00
Edwin Cheng
e8741b9d75 Use new expansion feature in goto_definition 2019-11-05 01:38:20 +08:00
Edwin Cheng
67226ebc82 Remove dbg! 2019-11-05 01:38:20 +08:00
Edwin Cheng
d560219d06 Fixed bug in ExpandedRangeMap 2019-11-05 01:38:20 +08:00
Edwin Cheng
ae609d7953 Add parent_expansion to HirFileId 2019-11-05 01:38:20 +08:00
Edwin Cheng
159da285e9 Add macro_expansion_info in hir_expand 2019-11-05 01:38:20 +08:00
Edwin Cheng
9fd546bec2 Add map_id to TokenId 2019-11-05 01:38:20 +08:00
bors[bot]
d9fb01f803
Merge #2173
2173: MBE: Add TokenId shift in macro_rules r=matklad a=edwin0cheng

As discussed in #2169 , for fixing duplication TokenId during expansion :

> What we can do here is to re-number the tokens during expansion. Specifically:
> * when we create macro_rules, we note the highest id of the token we have as shift>
> * when we expand macro rules, if we need to output a token from definition, we just re-use its id
> * if we need to output a token from the argument, we increase its id by shift (so it's guaranteed to not to collide with anything from the definition)
> * finally, when we have a HirFileId of the expansion, we can look up the original value of shift and classify node to the arg/def by comparing it's id with shift.
> 

This PR implement first 3 points of above solution. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-04 17:21:41 +00:00
Edwin Cheng
a5839662f4 Change to add 1 if non zero shift 2019-11-05 01:16:06 +08:00
Edwin Cheng
188a1412b9 Refactor and rename 2019-11-05 01:01:05 +08:00
Edwin Cheng
42661a3b27 Change Option<u32> to u32 for shift value 2019-11-05 00:33:19 +08:00
Edwin Cheng
63e42bb5bd Change to better naming 2019-11-05 00:16:03 +08:00
Edwin Cheng
04af290d4e Add TokenId Shif in macro_rules 2019-11-04 23:22:18 +08:00
bors[bot]
cc2d75d0f8
Merge #2172
2172: Use new text DSL instead of crate_graph! macro r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 10:30:09 +00:00
Aleksey Kladov
38b941db13 Cleanup unused marks 2019-11-04 13:29:07 +03:00
Aleksey Kladov
dfdb6321ac Use new text DSL instead of crate_graph! macro 2019-11-04 13:25:42 +03:00
bors[bot]
fe6ba12a77
Merge #2149
2149: Handle IfLet in convert_to_guarded_return. r=matklad a=krk

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2124

I could not move the cursor position out of `let`:
`le<|>t` vs `let<|>`.

Also, please suggest extra test cases.

Co-authored-by: krk <keremkat@gmail.com>
2019-11-04 09:06:53 +00:00
Aleksey Kladov
3603d02134 Reexport relative_path from ra_db 2019-11-04 01:14:17 +03:00
Aleksey Kladov
8922a44395 Add small module-level docs 2019-11-04 00:23:14 +03:00
Aleksey Kladov
f0eb9cc6e6 Remove last traces of nameres from hir 2019-11-03 23:49:44 +03:00
Aleksey Kladov
73fcf9a2d6 Restore crate_def_map marks 2019-11-03 23:44:23 +03:00
Aleksey Kladov
6fba51c5fc move crate_def_map tests to hir_def 2019-11-03 23:35:48 +03:00
Aleksey Kladov
0933d914a3 Introduce ra_db::fixture fixture module
The goal here is to share more testing infrastructure between crates.
2019-11-03 20:55:20 +03:00
Aleksey Kladov
ba2efca2bb Move CrateDefMap to hir_def 2019-11-03 18:04:06 +03:00
bors[bot]
f9f1effd01
Merge #2160
2160: Set `deprecated` field on `CompletionItem`s r=matklad a=martskins

This PR aims to address #2042 by setting the deprecated field for completion items.

The setting the tags field for LSP 3.15 part still needs fixing, but that one is blocked due to lsp-types not being up to date with 3.15 yet.

Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
2019-11-03 14:41:30 +00:00
Martin Asquino
ccf8817d18 Use bool instead of Option<bool> and print it's value only when true 2019-11-02 19:33:34 -03:00
Laurențiu Nicola
c7b7d7e666 Silence some warnings 2019-11-03 00:19:08 +02:00
Aleksey Kladov
13735d91a7 Move diagnostics to hir_expand 2019-11-02 23:42:38 +03:00
Martin Asquino
dc3848a6a3 Set deprecated field on CompletionItems 2019-11-02 17:37:47 -03:00
Aleksey Kladov
b8533413cf Move Source to hir_expand 2019-11-02 23:11:27 +03:00
Florian Diebold
c5e44b2084 Upgrade Chalk 2019-11-02 15:32:08 +01:00
Florian Diebold
8952380884 Change SourceAnalyzer method resoltion API 2019-11-01 20:01:21 +01:00
Florian Diebold
b29092ade3 Various review fixes 2019-11-01 19:57:08 +01:00
Florian Diebold
dc4066ebed Add some doc comments 2019-11-01 19:57:08 +01:00
Florian Diebold
77c26c2bf1 Complete items on traits as well 2019-11-01 19:57:08 +01:00
Florian Diebold
79cb0a0dab Complete trait assoc items 2019-11-01 19:57:08 +01:00
Florian Diebold
5da941897d Add failing tests for trait assoc method completion 2019-11-01 19:57:08 +01:00
Florian Diebold
b0bf1deb7c Refactor a bit 2019-11-01 19:57:08 +01:00
Florian Diebold
f4181deb0d Don't do autoderef for path resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
1173c3dab5 Refactor to unify with method resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
c7cedea270 Record assoc item resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
7b7133ec58 Insert type vars before doing assoc item resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
44279ef1df Add another unrelated, currently not working test 2019-11-01 19:57:08 +01:00