Edwin Cheng
4195c0e5f9
Add macro keyword to ITEM_RECOVERY_SET
2019-12-21 18:42:17 +08:00
Edwin Cheng
bea8f58118
Add macro 2.0 support in parser
2019-12-21 18:29:14 +08:00
bors[bot]
3ebf15c9b2
Merge #2626
...
2626: Recursive collect macros in impl items r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-21 10:12:18 +00:00
bors[bot]
b902d4403a
Merge #2627
...
2627: Use SelectionRange from LSP 3.15 r=matklad a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-12-21 10:01:42 +00:00
bors[bot]
1cbef27ff8
Merge #2625
...
2625: Clippy lints r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-21 06:12:36 +00:00
Jeremy Kolb
429199d481
Use SelectionRange from LSP 3.15
2019-12-20 18:57:31 -05:00
Edwin Cheng
c1166697a7
Add a limit for protect against infinite recursion
2019-12-21 05:16:29 +08:00
Edwin Cheng
360de5ba71
Recursive collect macros in impl items
2019-12-21 05:02:31 +08:00
kjeremy
0d5d63a80e
Clippy lints
2019-12-20 15:14:30 -05:00
bors[bot]
6eab968c60
Merge #2624
...
2624: Separate module item from module scope r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 19:51:03 +00:00
bors[bot]
f578cd2182
Merge #2623
...
2623: Add support macros in impl blocks r=matklad a=edwin0cheng
This PR add support for macros in impl blocks, which reuse `Expander` for macro expansion.
see also: #2459
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 19:42:46 +00:00
Edwin Cheng
ad81d1dbc1
Add support macros in impl blocks
2019-12-21 03:37:03 +08:00
Aleksey Kladov
f5947be0ea
Simplify
2019-12-20 20:15:54 +01:00
bors[bot]
02f9e04ee9
Merge #2617
...
2617: Remove index resolving from hover r=matklad a=kjeremy
I have left in `HoverResult`'s support for multiple entries because we may still want that at some point.
Per https://github.com/rust-analyzer/rust-analyzer/issues/2542#issuecomment-565238142
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 18:16:16 +00:00
Florian Diebold
44b00aed4a
Coerce closures to fn pointers
...
E.g. `let x: fn(A) -> B = |x| { y };`
2019-12-20 18:54:33 +01:00
Florian Diebold
9c3f00a906
Fix coercion of last expression in function body
2019-12-20 18:28:21 +01:00
Florian Diebold
2a8c9100bf
Handle closure return types
...
Fixes #2547 .
2019-12-20 18:16:11 +01:00
kjeremy
77626d7bda
Remove unused imports
2019-12-20 11:18:24 -05:00
kjeremy
428358925c
Remove the index resolution from hover
...
We are reasonably precise now to do this.
2019-12-20 11:16:47 -05:00
Aleksey Kladov
7a862f0d47
Make legacy macros private
2019-12-20 17:12:20 +01:00
Aleksey Kladov
af42cb5981
Privitize impls
2019-12-20 16:55:38 +01:00
Aleksey Kladov
7adb53319d
Make items private
2019-12-20 16:52:02 +01:00
Aleksey Kladov
e6b1194f2f
Move some code to scope
2019-12-20 16:52:02 +01:00
Aleksey Kladov
4f9e3f3632
Fix typos
2019-12-20 16:52:02 +01:00
Aleksey Kladov
1b8ce5b37b
Move impls to ItemScope
2019-12-20 16:52:02 +01:00
Aleksey Kladov
030e540ad1
Reduce visibility
2019-12-20 16:52:02 +01:00
Aleksey Kladov
2ce1aa32c4
Rename ModuleScope -> ItemScope
2019-12-20 16:52:02 +01:00
Aleksey Kladov
16ac792f48
Docs
2019-12-20 16:52:02 +01:00
Aleksey Kladov
0f212b3798
Move ModuleScope to a new module
2019-12-20 16:52:02 +01:00
Aleksey Kladov
49aac9ef63
Add item_scope module
2019-12-20 16:52:02 +01:00
Edwin Cheng
4a7e19946a
Fix parser for macro call in pattern position
2019-12-20 23:26:04 +08:00
bors[bot]
af5e2abe15
Merge #2614
...
2614: Clippy cleanup r=matklad a=kjeremy
Just a few tweaks from the latest clippy. There are a lot more but we should probably tweak our settings.
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 14:46:24 +00:00
kjeremy
f22aabc136
Use unwrap_or_default
2019-12-20 09:43:30 -05:00
kjeremy
133b4063a6
Remove useless clone
2019-12-20 09:43:01 -05:00
bors[bot]
d590f6ce12
Merge #2592
...
2592: Add std::ops::Index support for infering r=edwin0cheng a=edwin0cheng
see also #2534
Seem like this can't fix #2534 for this case:
```rust
fn foo3(bar: [usize; 2]) {
let baz = bar[1]; // <--- baz is still unknown ?
println!("{}", baz);
}
```
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 14:36:53 +00:00
Aleksey Kladov
794bbab70d
Remove code that never was alive?
2019-12-20 15:26:19 +01:00
Aleksey Kladov
3d4b48e481
Fix resolve for field init shorthand
2019-12-20 14:48:14 +01:00
Aleksey Kladov
77af7b087f
Fix highlighting for field init shorthand
2019-12-20 14:12:14 +01:00
Aleksey Kladov
d057afb945
Improve highlighting test
2019-12-20 14:12:14 +01:00
Aleksey Kladov
2d8a001465
Reduce copy-paste some more
2019-12-20 13:58:09 +01:00
Aleksey Kladov
1234dda9ee
Use generic ItemLoc for impls
2019-12-20 13:47:44 +01:00
Aleksey Kladov
d137df0137
Remove more copy-paste
2019-12-20 13:19:41 +01:00
Aleksey Kladov
957c0171e6
Remove more copy-paste
2019-12-20 13:11:01 +01:00
Aleksey Kladov
f42697e54b
Support for nested traits
2019-12-20 12:29:25 +01:00
Aleksey Kladov
fe1b160dcf
Support for nested statics, consts and type aliases
2019-12-20 12:22:55 +01:00
Aleksey Kladov
ac5a3f611b
Support for nested ADT
2019-12-20 12:20:49 +01:00
Aleksey Kladov
94ad07af4b
Introduce ContainerId
2019-12-20 12:07:23 +01:00
Aleksey Kladov
8fc20b6503
Rename ContainerId -> AssocContainerId
2019-12-20 12:00:05 +01:00
Aleksey Kladov
67c2aea182
Rebuild ra_lsp_server and nest helper function.
...
Completion now works again, so there's no need not to nest
2019-12-20 11:52:17 +01:00
Aleksey Kladov
d316ba9a13
Handle nested declrations in from_source
2019-12-20 11:52:17 +01:00
Aleksey Kladov
a04177f135
Add local functions to bodies
2019-12-20 11:52:17 +01:00
Edwin Cheng
76d688a328
Use fill instread of for loop
2019-12-20 03:04:55 +08:00
Aleksey Kladov
9ccad60acc
Implement ChildBySource for DefWithBody
2019-12-19 18:21:26 +01:00
Aleksey Kladov
ba12e83c26
Add body as a possible container for items
2019-12-19 18:12:46 +01:00
Aleksey Kladov
5bd8de3f5e
Allow storing defs in bodies
2019-12-19 18:09:50 +01:00
Aleksey Kladov
b2731ab78a
Drop dead code
2019-12-19 18:07:39 +01:00
bors[bot]
f00904e996
Merge #2598
...
2598: Touch up TokenSet a bit r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-19 16:15:19 +00:00
Aleksey Kladov
0ed8ce096d
Touch up TokenSet a bit
2019-12-19 17:13:33 +01:00
bors[bot]
aee2eee362
Merge #2597
...
2597: Handle start imports in import groups r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-19 16:04:24 +00:00
Aleksey Kladov
43ed3d1196
Handle start imports in import groups
2019-12-19 16:57:22 +01:00
bors[bot]
a766f63650
Merge #2594
...
2594: Omit default parameter types r=matklad a=SomeoneToIgnore
Part of https://github.com/rust-analyzer/rust-analyzer/issues/1946
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-12-19 15:35:42 +00:00
Aleksey Kladov
6edc54a1e6
Refactor macro tests
2019-12-19 16:23:23 +01:00
Kirill Bulatov
f407ac2be3
Omit default types for hover pop-ups
2019-12-19 16:47:09 +02:00
Kirill Bulatov
4ed78f80f4
Remove TruncateOptions struct
2019-12-19 16:43:41 +02:00
Edwin Cheng
b61ad6a964
Use build_for_def
2019-12-19 22:28:52 +08:00
Kirill Bulatov
4fb25ef43b
Do not add any new configuration parameters
2019-12-19 16:18:09 +02:00
Aleksey Kladov
5c3c2b8690
Fix parsing of interpolated expressions
2019-12-19 14:43:19 +01:00
Kirill Bulatov
3969c7c853
Ensure hover shows full type declaration
2019-12-19 12:45:00 +02:00
Kirill Bulatov
14c167a9f6
Omit default parameter types
2019-12-19 12:27:33 +02:00
Edwin Cheng
dddee23f43
Add std::ops::Index support for infering
2019-12-19 12:45:07 +08:00
bors[bot]
8dd0e0086f
Merge #2589 #2591
...
2589: Touch up docs r=matklad a=matklad
2591: Remove dead code r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-18 16:54:28 +00:00
Aleksey Kladov
afdeacf3c1
Remove dead code
2019-12-18 17:52:52 +01:00
bors[bot]
b63c7ecab9
Merge #2311
...
2311: See through Macros for SignatureHelp r=matklad a=kjeremy
Note: we meed to skip the trivia filter to make sure that
`covers!(call_info_bad_offset)` succeeds otherwise we exit call_info
too early.
Also the test doesn't pass: `FnCallNode::with_node` always detects
a MacroCall which is obviously wrong.
Fixes #2310
Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-12-18 16:44:35 +00:00
Aleksey Kladov
d33fc26e05
Touch up docs
2019-12-18 17:42:49 +01:00
Aleksey Kladov
04715cbe1c
Forbid <T>::foo syntax in mod paths
2019-12-18 17:41:33 +01:00
Aleksey Kladov
88c6109897
Move PathKindUp
2019-12-18 17:06:52 +01:00
Aleksey Kladov
d043689735
Touch up docs
2019-12-18 17:04:20 +01:00
Aleksey Kladov
7c25224f05
Don't bother with focus range for navigation to locals
2019-12-18 16:45:42 +01:00
Aleksey Kladov
46a299bcee
Refactor goto tests to always specify texts
2019-12-18 16:00:35 +01:00
Aleksey Kladov
69c944a1e2
Add blank lines for readability
2019-12-18 16:00:35 +01:00
Jeremy Kolb
83dc5e7949
cargo fmt
2019-12-18 09:11:47 -05:00
Jeremy Kolb
cdc6af6bda
Pass test
2019-12-18 08:58:48 -05:00
kjeremy
7ec43ee07a
WIP: See through Macros for SignatureHelp
...
Note: we meed to skip the trivia filter to make sure that
`covers!(call_info_bad_offset)` succeeds otherwise we exit call_info
too early.
Also the test doesn't pass: `FnCallNode::with_node` always detects
a MacroCall.
2019-12-18 08:49:06 -05:00
Edwin Cheng
41544a4088
Refactoring
2019-12-18 13:10:37 +08:00
Edwin Cheng
2ea1cfd780
Rename range to by_kind
2019-12-18 11:36:10 +08:00
Edwin Cheng
e16f3a5ee2
Add test for token map
2019-12-18 11:20:23 +08:00
Edwin Cheng
325532d119
Fix shift id for delim and other tokens
2019-12-18 11:20:23 +08:00
Edwin Cheng
320416d756
Add TokenTextRange
2019-12-18 11:20:22 +08:00
Edwin Cheng
59295854f8
Add token id to delims
2019-12-18 11:20:22 +08:00
Edwin Cheng
aceb9d7fb0
Add token ids for all tt::Leaf
2019-12-18 11:20:22 +08:00
bors[bot]
ff8f80579a
Merge #2582
...
2582: Drop dead code r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 15:03:38 +00:00
Aleksey Kladov
0630f8110f
Drop dead code
2019-12-17 16:03:15 +01:00
bors[bot]
b90f9e6d59
Merge #2581
...
2581: Refactor PathKind r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 14:39:07 +00:00
Aleksey Kladov
aca022f1d4
Refactor PathKind
2019-12-17 15:38:28 +01:00
bors[bot]
f51a3fed9f
Merge #2580
...
2580: Fix highlighting token names r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 13:46:12 +00:00
Aleksey Kladov
1c8467e20a
Fix highlighting token names
2019-12-17 14:45:46 +01:00
bors[bot]
4a58522119
Merge #2562
...
2562: Fix NavigationTarget ranges r=matklad a=edwin0cheng
Fix the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553
This PR change the order for finding `full_range` of `focus_range` in following orders:
1. map both ranges to macro_call
2. map focus range to a token inside macro call, and full range to the whole of macro call
3. map both ranges to the whole of macro call
And fix the corresponding tests and make these tests easily to follow.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 13:37:32 +00:00
Aleksey Kladov
3e2f4e4293
Improve recovery for incomplete lambdas
2019-12-17 12:11:01 +01:00
Florian Diebold
91853590a9
Add test mark
2019-12-15 21:06:08 +01:00
Florian Diebold
6e1c2d0df8
Handle impl Trait more correctly
...
When calling a function, argument-position impl Trait is transparent; same for
return-position impl Trait when inside the function. So in these cases, we need
to represent that type not by `Ty::Opaque`, but by a type variable that can be
unified with whatever flows into there.
2019-12-15 18:56:38 +01:00