Commit Graph

772 Commits

Author SHA1 Message Date
Edwin Cheng
80fe467ce8 Improve insert_whitespaces 2019-11-20 00:12:48 +08:00
Edwin Cheng
4012da07fd Change return type of expand_macro 2019-11-19 22:56:48 +08:00
Edwin Cheng
94c63d2802 Change to use Expansion::file_id and reordering 2019-11-19 22:56:28 +08:00
Edwin Cheng
ae49a22b5c Rebase 2019-11-19 21:49:06 +08:00
Edwin Cheng
3ccd05fedc Add recursive expand in vscode 2019-11-19 21:49:06 +08:00
bors[bot]
c24ee09904
Merge #2309
2309: Goto type def through macros r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-18 20:04:36 +00:00
kjeremy
e939f740b3 Goto type def through macros 2019-11-18 14:57:42 -05:00
kjeremy
90f6f6080e Fix test 2019-11-18 14:20:14 -05:00
kjeremy
b2cc593381 Support hover through macro 2019-11-18 11:58:42 -05:00
kjeremy
a22cb1daa7 Use Source<&ast::Name> in classify_name 2019-11-18 10:47:19 -05:00
Aleksey Kladov
b79d678923 Token-based reverse-mapping 2019-11-18 15:08:39 +03:00
Aleksey Kladov
5e8c22dbf3 More sources 2019-11-18 14:36:11 +03:00
Aleksey Kladov
9fcd98e956 Add ra_ide_api::expand
This module should handle all tricky bits with mapping macro-expanded
HirFileId to original files the user actually can see in the editor
2019-11-18 14:23:24 +03:00
Aleksey Kladov
6d8ca870b3 More Source 2019-11-18 14:07:13 +03:00
Aleksey Kladov
fd52d721e1 More correct expansion mapping
We can't really map arbitrary ranges, we only can map tokens
2019-11-17 20:15:55 +03:00
Aleksey Kladov
7e2f4b30db Disable doctests 2019-11-17 18:35:05 +03:00
Aleksey Kladov
42604c673d Better factoring of macro expansion machinery in goto def 2019-11-16 22:18:07 +03:00
Aleksey Kladov
2eaa8c94a8 Goto definition works inside macros 2019-11-16 17:00:54 +03:00
Aleksey Kladov
3b7cf9226d Source-ify name_definition 2019-11-16 13:50:04 +03:00
Aleksey Kladov
272af56a5c Sourcify classify_name_ref 2019-11-16 13:33:25 +03:00
bors[bot]
d9d99369b2
Merge #2271
2271: Force passing Source when creating a SourceAnalyzer r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 23:12:59 +00:00
Aleksey Kladov
d898ecb8f2 Force passing Source when creating a SourceAnalyzer 2019-11-16 02:12:35 +03:00
kjeremy
06984ed116 Add a test that uses classify_name 2019-11-15 17:13:52 -05:00
kjeremy
60fd260e7f Handle ast::MacroCall in classify_name and impl FromSource for MacroDef
Fixes #2260
2019-11-15 16:47:58 -05:00
Aleksey Kladov
4c90b7e2ec Sourcify some things
If we want to support macros properly, we need to get rid of those
FileIds everywhere...
2019-11-15 23:24:56 +03:00
Aleksey Kladov
b21829f7ed Remove old impls infrastructure 2019-11-15 21:35:03 +03:00
Aleksey Kladov
3564fbb7f5 Auto-upgrade some insta snapshots 2019-11-15 12:56:24 +03:00
Aleksey Kladov
b80fa14a85 Use Local more 2019-11-15 12:00:36 +03:00
Jeremy Kolb
89647f93c4 Cleanup hover
Take advantage of classify_name
2019-11-14 22:53:42 -05:00
Aleksey Kladov
fc055281a5 Minor cleanup 2019-11-12 11:49:16 +03:00
Greg
088e5e1721
fix typo 2019-11-11 22:56:39 -05:00
Greg
eb72156094
Implement postfix completions feature flag 2019-11-11 22:55:10 -05:00
Aleksey Kladov
c5a18c44e5 Introduce hir::GenericParam
Unlike existing hir::GenericParams, this is a global ID.
2019-11-11 17:36:27 +03:00
Aleksey Kladov
8b7f853cc1 Add hir::Local 2019-11-11 14:42:08 +03:00
Aleksey Kladov
ef70925f5f Refactor highlighting to use classify_name 2019-11-11 12:52:14 +03:00
Aleksey Kladov
4deba88c33 Introduce ToNav trait 2019-11-11 12:19:57 +03:00
Aleksey Kladov
5bb92c2d1a impl fmt::Display for BuiltinType 2019-11-11 11:59:19 +03:00
bors[bot]
113d7e44b7
Merge #2203
2203: Hover for builtins r=matklad a=kjeremy

Fixes #2192 

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-11 08:41:54 +00:00
Jeremy Kolb
3188c1451a Hover for builtins 2019-11-10 13:59:39 -05:00
Matthias Einwag
8baa05666c Add tests for resolving types in core and std preludes 2019-11-09 17:38:08 -08:00
bors[bot]
561bb979ce
Merge #2169
2169: MBE: Mapping spans for goto definition r=matklad a=edwin0cheng

Currently, go to definition gives the wrong span in MBE.  This PR implement a mapping mechanism to fix it and it could be used for future MBE hygiene implementation.

The basic idea of the mapping is:
1. When expanding the macro, generated 2 `TokenMap` which maps the macro args and macro defs between tokens and input text-ranges.
2. Before converting generated `TokenTree` to `SyntaxNode`, generated a `ExpandedRangeMap` which is a mapping between token and output text-ranges.
3. Using these 3 mappings to construct an `ExpansionInfo`  which can map between input text ranges and output text ranges.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-09 09:13:14 +00:00
Edwin Cheng
0a5ec69404 Remove map_ranges in RevTokenMap 2019-11-09 12:00:46 +08:00
Edwin Cheng
d01e0abdb5 Refactor and simpfily 2019-11-09 04:26:28 +08:00
bors[bot]
14e19c0df1
Merge #2179
2179: Use HirDatabase to compute `is_deprecated` r=matklad a=martskins

This PR fixes #2167 by introducing `attributes_query` and adding `fn attrs(&self, def: crate::AttrDef) -> Option<Arc<[Attr]>>;`  to the `DefDatabase` trait.

I'm a little concerned about the two spots in `attributes_query` where code is repeated, but I couldn't figure out a way to avoid that, so.. I welcome suggestions 😄 



Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
2019-11-06 21:11:42 +00:00
Aleksey Kladov
b5349af05f Cleanup complete_postfix 2019-11-06 14:50:03 +03:00
Martin Asquino
cb3767f28a HirDatabase stored attributes 2019-11-04 18:16:35 -03: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
Aleksey Kladov
3603d02134 Reexport relative_path from ra_db 2019-11-04 01:14:17 +03:00