Commit Graph

787 Commits

Author SHA1 Message Date
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
oxalica
24d50ebcd1
Guess macro braces from docs 2019-10-21 02:16:01 +08:00
kjeremy
c3045c68a9 relative-path 1.0 2019-10-17 13:08:33 -04:00
bors[bot]
762fce5bdd
Merge #2012
2012: #1435 postfix completion for integer literals r=matklad a=pasa

Fix for #1435 Incorrect postfix completion for integer literals

Co-authored-by: Sergey Parilin <parilinsa@gmail.com>
2019-10-17 11:21:00 +00:00
Sergey Parilin
bec47e221f #1435 postfix completion for integer literals 2019-10-14 18:39:40 +03:00
bors[bot]
8e3864fd58
Merge #2008
2008: Prepare SourceDatabase API for lazy file loading r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-14 13:26:42 +00:00
Aleksey Kladov
abf2179c0b Prepare SourceDatabase API for lazy file loading 2019-10-14 16:23:55 +03:00
kjeremy
a1d631da4f Use correct db type 2019-10-11 15:56:17 -04:00
bors[bot]
f70c54ccfb
Merge #1994
1994: remove last traces of source roots from hir r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-11 07:49:39 +00:00
Aleksey Kladov
e44c7ce200 remove last traces of source roots from hir 2019-10-11 10:48:46 +03:00
Shotaro Yamada
04741ae2bc Use original_file instead of as_original_file 2019-10-11 06:50:53 +09:00
Aleksey Kladov
8d3d5cbdb0 tweak fn labels in completion 2019-10-10 18:09:14 +03:00
Aleksey Kladov
31561b118f if completion does auto-insertion, indicate this in the label 2019-10-10 13:18:42 +03:00
bors[bot]
afc871199d
Merge #1973
1973: add <> for type aliases as well r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-09 08:54:00 +00:00
Aleksey Kladov
d9f83d9b16 add <> for type aliases as well 2019-10-09 11:53:32 +03:00
Aleksey Kladov
048be5d9a3 smal cleanup 2019-10-09 11:26:41 +03:00
bors[bot]
b976772566
Merge #1972
1972: extend selection correctly handles commas in tuples r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-09 08:26:31 +00:00
Aleksey Kladov
8d65530843 extend selection correctly handles commas in tuples 2019-10-09 11:26:09 +03:00
Aleksey Kladov
e0b1c17dcb add <> when completing generic types 2019-10-08 21:14:52 +03:00
Aleksey Kladov
f4fa98b1bf simplify 2019-10-08 20:34:30 +03:00
Aleksey Kladov
2f85a640a2 refactor 2019-10-08 20:32:19 +03:00
bors[bot]
06a8deae4a
Merge #1969
1969: restore coloring of attributes r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-08 11:55:27 +00:00
Aleksey Kladov
6503add6e3 restore coloring of attributes 2019-10-08 14:52:03 +03:00
ice1000
b043358be9 Address comments: fix docs, add completion test for Self. 2019-10-08 07:32:41 -04:00
Aleksey Kladov
355419d404 use slightly more idiomatic api for cfg 2019-10-08 14:22:49 +03:00
ice1000
6bad638928 Support inferring Self type in enum definitions
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
2019-10-07 19:40:14 -04:00
bors[bot]
d3872964f8
Merge #1960
1960: Replace AST visitors with macro r=viorina a=viorina

Fixes #1672.

Co-authored-by: Ekaterina Babshukova <ekaterina.babshukova@yandex.ru>
2019-10-05 14:54:25 +00:00
Ekaterina Babshukova
2fc2290173 replace AST visitors with macro 2019-10-05 17:03:03 +03:00