Commit Graph

814 Commits

Author SHA1 Message Date
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
Aleksey Kladov
ba2efca2bb Move CrateDefMap to hir_def 2019-11-03 18:04:06 +03: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
Martin Asquino
dc3848a6a3 Set deprecated field on CompletionItems 2019-11-02 17:37:47 -03:00
Florian Diebold
8952380884 Change SourceAnalyzer method resoltion API 2019-11-01 20:01:21 +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
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
kjeremy
c46be83a34 Fixes #2143 2019-10-31 13:29:56 -04:00
kjeremy
4ad37df223 runnables => match_ast! 2019-10-30 16:09:16 -04:00
kjeremy
4d17658940 Use match_ast! in FnCallNode::with_node 2019-10-30 14:39:05 -04:00
kjeremy
b441b4e8ef Some clippy fixes 2019-10-30 13:36:37 -04:00
Aleksey Kladov
c1ed9ccc4e fix compilation 2019-10-30 18:04:24 +03:00
Aleksey Kladov
c9cd6aa370 Move ids to hir_def crate 2019-10-30 13:11:38 +03:00
bors[bot]
8046f5b24a
Merge #2125
2125: don't add macro braces in use items r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-30 07:40:23 +00:00
Aleksey Kladov
d7a7da8261 don't add macro braces in use items 2019-10-30 10:39:12 +03:00
kjeremy
4ca5d4c353 Add missing test for label 2019-10-29 15:25:31 -04:00
kjeremy
eb220a081b Primitive signature help for mbe 2019-10-29 12:16:55 -04:00
bors[bot]
de16f94ada
Merge #2103
2103: Expand signature help r=matklad a=kjeremy

Signature help using call syntax with tuple structs and enum variants

Fixes #2102.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-29 13:48:26 +00:00
kjeremy
b915bf2d05 SigKind -> CallableKind 2019-10-29 09:46:55 -04:00
Aleksey Kladov
bca708ba4c cleanup 2019-10-29 16:19:08 +03:00
kjeremy
01238a6fd7 Filter out non callable versions of Struct/EnumVariant 2019-10-28 10:48:40 -04:00
Jeremy Kolb
ddf25e9481 formatting 2019-10-28 08:42:17 -04:00
Jeremy Kolb
44f2805fee Fix syntax 2019-10-28 08:32:23 -04:00
Jeremy Kolb
49e89772f6 Preliminary enum variant support 2019-10-28 08:32:22 -04:00
Jeremy Kolb
55d4b06a53 Add disciminant 2019-10-28 08:32:22 -04:00
Jeremy Kolb
5a59bc9fcb WIP: Expand signature help
This is hacky but works for tuple structs. Proof of concept.
2019-10-28 08:32:22 -04:00
Jeremy Kolb
a0d55edc38 Be more precise with function signatures
Fixes #2093
2019-10-27 12:26:44 -04:00
Alexander Elís Ebenesersson
3e7e3fdf16 extend selection in trait bound extends to plus
When multiple traits bounds are present, expanded selection
from a single trait bound will include the nearest plus sign
(and whitespace after) before including the whole trait bound.
2019-10-27 21:29:06 +09:00
Aleksey Kladov
431e4ff4ef avoid TextEditorBuilder for simple edits 2019-10-26 20:09:56 +03:00
Aleksey Kladov
53e3bee0cf insert space after -> 2019-10-25 12:41:34 +03:00
Aleksey Kladov
ea948e9fbb refactor typing_handlers 2019-10-25 12:04:17 +03:00
Aleksey Kladov
6f00bb1cb0 introduce SingleFileChange 2019-10-25 11:49:38 +03:00
Aleksey Kladov
b112430ca7 move source change to a dedicated file 2019-10-25 11:30:50 +03:00
Aleksey Kladov
8d2fd59cfb make typing infra slightly more extensible 2019-10-25 11:30:46 +03:00
kjeremy
64c1dd10b8 bump insta 2019-10-24 10:35:22 -04:00
Aleksey Kladov
4529da906d for highlighting, search only the current file 2019-10-24 14:16:36 +03:00
Aleksey Kladov
6d186ec3be add search scope stuct 2019-10-24 13:41:25 +03:00
Aleksey Kladov
ac1b7b07e7 add some profiling calls 2019-10-24 10:37:20 +03:00
Ekaterina Babshukova
decfd28bd1 some fixes, add docs 2019-10-23 00:35:06 +03:00
Ekaterina Babshukova
b5a3ee93e2 support items that visible to the parent module 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
55e1910d00 classify module from declaration 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
93c179531b fix highlighting 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
328be5721a remove SearchScope 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
88ff88d318 use Lazy, some fixes 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
19fbf2c16b remove unreachable!() 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
835173d065 replace trait by a bunch of functions 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
d26d0ada50 restructure a bit 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0dd08b8023 classify definition of a function right 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
df8441b24e some fixes, add tests 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
5b03773fbe implement search of references 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
01853e8d6c find scope for Declaration item 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
121aa35f12 return Declaration from classify_name_ref 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
83f780eabf return Declaration from classify_name 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0b5d0a41fd replace a chain of if let by macro 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
d6ae1b5f0f refactor name_ref_kind.rs 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
11577288c2 initial classify_name 2019-10-22 23:47:31 +03:00