Commit Graph

7175 Commits

Author SHA1 Message Date
Edwin Cheng
568f3cff41 Fix formatting 2019-11-05 09:43:59 +08:00
Seivan Heidari
6012bbfc51 Fix typo. 2019-11-05 00:26:49 +01:00
Seivan Heidari
ec82ca8391 Clearer docs usage under rust-analyzer.scopeMappings. 2019-11-05 00:18:16 +01:00
Seivan Heidari
2f1b363b39 Remove new line. 2019-11-05 00:16:31 +01:00
Seivan Heidari
f49781c32d Logging fallback tag in case scopes are missing. 2019-11-05 00:11:43 +01:00
Seivan Heidari
8eb5148af7 Merge branch 'master' into feature/themes 2019-11-05 00:00:30 +01:00
Seivan Heidari
c60f9bf4c6 * Adding scope mapping configuration manifest in package.json
* Loading configurable scope mappings from settings.
* Updating Readme with `rust-analyzer.scopeMappings`.
`rust-analyzer.scopeMappings` -- a scheme backed JSON object to tweak Rust Analyzer scopes to TextMate scopes.
   ```jsonc
    {
        //Will autocomplete keys to available RA scopes.
        "keyword.unsafe": ["keyword", "keyword.control"],
        //Values are string | TextMateScope | [string | TextMateScope]
        "comments": "comment.block"
    }
   ```
2019-11-04 23:59:11 +01:00
Martin Asquino
cb3767f28a HirDatabase stored attributes 2019-11-04 18:16:35 -03:00
bors[bot]
38f2bd21fb
Merge #2177
2177: Reduce visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 20:37:59 +00:00
Aleksey Kladov
93d9e8a06f Reduce visibility 2019-11-04 23:37:35 +03:00
bors[bot]
c08cff4fd6
Merge #2176
2176: Move Namespace enum closer to usage r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 20:03:11 +00:00
Aleksey Kladov
739babc391 Move Namespace enum closer to usage 2019-11-04 23:02:35 +03:00
bors[bot]
9c93fbf346
Merge #2175
2175: Appease the linter by dummy doc comments r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 19:35:43 +00:00
Aleksey Kladov
50364bd478 Appease the linter by dummy doc comments 2019-11-04 22:33:21 +03:00
Aleksey Kladov
fd7819c3c0 Simplify 2019-11-04 22:29:51 +03:00
Aleksey Kladov
42370610ce Restore assists tests 2019-11-04 22:28:47 +03:00
Aleksey Kladov
74d827bb80 Rename MockDatabase -> TestDB
Actually working rename is sooo useful!
2019-11-04 22:21:15 +03:00
Edwin Cheng
2a76bb5a0b Refactor a bit 2019-11-05 03:20:54 +08:00
Aleksey Kladov
7649a8ebbe remove dead code 2019-11-04 22:19:06 +03:00
Aleksey Kladov
24894aca31 Remove more duplication in test fixtures 2019-11-04 22:12:49 +03:00
Aleksey Kladov
dcdcc9e4c8 Remove some duplicated test functions 2019-11-04 22:04:51 +03:00
bors[bot]
7c0d7d3838
Merge #2174
2174: Reduce visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 18:42:55 +00:00
Aleksey Kladov
d04ecc8419 Reduce visibility 2019-11-04 21:42:25 +03: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
Seivan Heidari
dad9bc6caa Merge branch 'master' into feature/themes 2019-11-04 13:45:27 +01: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
bors[bot]
5c35539f0f
Merge #2171
2171: Reexport relative_path from ra_db r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-03 22:29:30 +00:00
Aleksey Kladov
3603d02134 Reexport relative_path from ra_db 2019-11-04 01:14:17 +03:00
bors[bot]
e811be0fdc
Merge #2166
2166: Fix snapshots and tests line-ending in Windows r=matklad a=edwin0cheng

When running `cargo test` in Windows, there are some test and snapshots generated which are `LF` line-endings. 

This PR try to force `git` to use `LF` for these files.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-03 21:47:04 +00:00
bors[bot]
4fd742d6bc
Merge #2163
2163: Move CrateDefMap to hir_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-03 21:34:50 +00:00
Aleksey Kladov
8922a44395 Add small module-level docs 2019-11-04 00:23:14 +03:00