Commit graph

105 commits

Author SHA1 Message Date
Lukas Wirth
a872ebf81f Support unions in symbol search 2021-01-24 01:32:52 +01:00
bors[bot]
0c37b3a0fc
Merge #7353
7353: Add LifetimeParam and ConstParam to CompletionItemKind r=matklad a=Veykril

Adds `LifetimeParam` and `ConstParam` to `CompletionItemKind` and maps them both to `TypeParam` in the protocol conversion as there are no equivalents, so nothing really changes there.
`ConstParam` could be mapped to `Const` I guess but I'm split on whether that would be better?

Additions were solely inspired by (the single) test output for const params.

Also sorts the variants of `CompletionItemKind` and its to_proto match.



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-22 15:31:47 +00:00
Jonas Schievink
896dfacfc4 Add name resolution query for block expressions 2021-01-21 15:22:17 +01:00
Jonas Schievink
82146737ac Treat BlockExpr as a potential module origin 2021-01-20 20:05:48 +01:00
Lukas Wirth
f2cb7dbcb7 Partially unify SymbolKind and CompletionItemKind 2021-01-20 18:39:46 +01:00
Jonas Schievink
0587b99fde Make public DefMap fields private 2021-01-20 15:41:18 +01:00
Lukas Wirth
563a175fdb Move SymbolKind to ide_db 2021-01-20 15:25:34 +01:00
Aleksey Kladov
46b4f89c92 . 2021-01-20 01:56:11 +03:00
bors[bot]
342bf41022
Merge #7297 #7338
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore

![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif)

Closes #7248

7338: Parse `impl const Trait` r=Veykril a=Veykril

Closes #7313

bors r+

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:40:11 +00:00
bors[bot]
9daba961f2
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril

That should be the remaining special casing for `self` 🎉 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 16:13:06 +00:00
bors[bot]
9eb37fbdeb
Merge #7292
7292: Swap assert_eq_text\!(expected, actual) r=matklad a=u5surf

Fixes #7283 

Swap assert_eq_text parameters in the order (expected, actual)

Co-authored-by: yugo-horie <u5.horie@gmail.com>
2021-01-18 10:12:54 +00:00
Kirill Bulatov
09c11054a1 Do trait solving in batch 2021-01-17 02:57:38 +02:00
Kirill Bulatov
68626e4ef5 Draft the working completion 2021-01-17 02:57:34 +02:00
Kirill Bulatov
db335a1bbf Add flyimport completion for trait assoc items 2021-01-16 20:44:12 +02:00
Kirill Bulatov
6742f38e49 Share import_assets and related entities 2021-01-16 19:33:36 +02:00
yugo-horie
f273995a25 Swap assert_eq_text\!(expected, actual) 2021-01-16 13:30:26 +09:00
Lukas Wirth
98718e0544 Wrap remaining self/super/crate in Name{Ref} 2021-01-15 22:18:43 +01:00
unexge
a3a722de9f Add Unmerge Use assist 2021-01-15 22:14:51 +03:00
Lukas Wirth
cb863390f2 Handle self/super/crate in PathSegment as NameRef 2021-01-15 19:21:23 +01:00
Lukas Wirth
d5095329a1 Phase out SourceFileEdits in favour of a plain HashMap 2021-01-14 22:43:36 +01:00
Lukas Wirth
f51457a643 Group file source edits by FileId 2021-01-14 18:35:22 +01:00
bors[bot]
39167b97d8
Merge #7260
7260: Render Fn* trait objects and impl types as rust does r=matklad a=Veykril

Also fixes raw ptr impl types being rendered ambiguously with multiple predicates.
This moves out the `FamousDefs::Fixture` into its own file as well, cause I figured it is big enough to get its own file at this point + we also get highlighting this way when editing it.

Fixes #3012

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-14 09:07:15 +00:00
Lukas Wirth
3d6480bc31 Render Fn* trait objects and impl types as rust does 2021-01-13 13:29:47 +01:00
Lukas Wirth
e9e3ab549d Move FamousDefs fixture out into its own file 2021-01-12 17:26:08 +01:00
Lukas Wirth
aff9102afb Rename FileReferences -> UsageSearchResult 2021-01-12 15:56:24 +01:00
Lukas Wirth
2c1777a2e2 Ensure uniqueness of file ids in reference search via hashmap 2021-01-12 15:51:02 +01:00
Lukas Wirth
fbdb32adfc Group references by FileId 2021-01-12 01:03:04 +01:00
bors[bot]
607b9ea160
Merge #7218
7218: Fix typos r=Veykril a=regexident

Apart from the very last commit on this PR (which fixes a public type's name) all changes are non-breaking.

Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-01-10 18:16:29 +00:00
Lukas Wirth
b795128dde Use hir::GenericParam in ide_db::Definition instead of relisting all 3 2021-01-10 12:33:47 +01:00
Vincent Esche
21f8239ac8 Fixed typos in code comments 2021-01-09 15:41:29 +01:00
bors[bot]
1a29934c37
Merge #7145
7145: Proper handling $crate Take 2 [DO NOT MERGE] r=edwin0cheng a=edwin0cheng

Similar to previous PR (#7133) , but improved the following things :

1. Instead of storing the whole `ExpansionInfo`, we store a similar but stripped version `HygieneInfo`.
2. Instread of storing the `SyntaxNode` (because every token we are interested are IDENT), we store the `TextRange` only.
3. Because of 2, we now can put it in Salsa.
4. And most important improvement: Instead of computing the whole frames every single time, we compute it recursively through salsa: (Such that in the best scenario, we only need to compute the first layer of frame)

```rust
        let def_site = db.hygiene_frame(info.def.file_id);
        let call_site = db.hygiene_frame(info.arg.file_id);

        HygieneFrame { expansion: Some(info), local_inner, krate, call_site, def_site }
```

The overall speed compared to previous PR is much faster (65s vs 45s) :
```
[WITH old PR]
Database loaded 644.86ms, 284mi
Crates in this dir: 36
Total modules found: 576
Total declarations: 11153
Total functions: 8715
Item Collection: 15.78s, 91562mi
Total expressions: 240721
Expressions of unknown type: 2635 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 865
Inference: 49.84s, 250747mi
Total: 65.62s, 342310mi
rust-analyzer -q analysis-stats .  66.72s user 0.57s system 99% cpu 1:07.40 total

[WITH this PR]
Database loaded 665.83ms, 284mi
Crates in this dir: 36
Total modules found: 577
Total declarations: 11188
Total functions: 8743
Item Collection: 15.28s, 84919mi
Total expressions: 241229
Expressions of unknown type: 2637 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 868
Inference: 30.15s, 135293mi
Total: 45.43s, 220213mi   
rust-analyzer -q analysis-stats .  46.26s user 0.74s system 99% cpu 47.294 total
```

*HOWEVER*,  it is still a perf regression (35s vs 45s):
```
[WITHOUT this PR]
Database loaded 657.42ms, 284mi
Crates in this dir: 36
Total modules found: 577
Total declarations: 11177
Total functions: 8735
Item Collection: 12.87s, 72407mi
Total expressions: 239380
Expressions of unknown type: 2643 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 868
Inference: 22.88s, 97889mi
Total: 35.74s, 170297mi
rust-analyzer -q analysis-stats .  36.71s user 0.63s system 99% cpu 37.498 total
```



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-08 03:57:11 +00:00
Kevaundray Wedderburn
72b9a4fbd3 Change <|> to $0 - Rebase 2021-01-07 12:09:23 +00:00
Aleksey Kladov
c8ace3a295 Remove some stale deprecations 2021-01-07 13:54:18 +03:00
Edwin Cheng
76f2b9d2ef Proper handling $crate Take 2 2021-01-07 13:08:32 +08:00
Aleksey Kladov
f8a0561178 Align config's API with usage
The config now is mostly immutable, optimize for that.
2021-01-06 21:22:24 +03:00
Kirill Bulatov
ca42a52051 Code review fixes 2021-01-04 18:33:05 +02:00
Jesse Bakker
c7e0c7f43a Upgrade expect-test to 1.1 2021-01-03 14:43:29 +01:00
Nick Spain
71c9a884d1 Fix type error with .and_then 2021-01-02 21:53:52 +11:00
Nick Spain
68b4efd536 Handle not finding range in Definition::search_scope
The `LifetimeParam` and `Local` variants use `source()` to find their
range. Now that `source()` returns an `Option` we need to handle the
`None` case.
2021-01-02 21:53:52 +11:00
Nick Spain
ea4708c444 Mark HasSource::source_old as deprecated but allow at all call sites 2021-01-02 21:53:51 +11:00
Nick Spain
27cadcd531 HasSource::source -> HasSource::source_old
To start migrating HasSource::source to return an Option.
2021-01-02 21:53:51 +11:00
bors[bot]
0e5fe47153
Merge #7080
7080: Implement ConstParams for HIR r=Veykril a=Veykril

r? @flodiebold 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-01 13:45:10 +00:00
Lukas Wirth
18bf2e5af5 Add ConstParams to the ide layer 2021-01-01 14:43:16 +01:00
kjeremy
dc1396eec7 Update crates 2020-12-30 10:39:50 -05:00
Laurențiu Nicola
42c24ff25f Avoid a couple of allocations 2020-12-29 14:35:49 +02:00
Kirill Bulatov
e4c3f753d2 Add docs and optimisations 2020-12-28 15:09:39 +02:00
Kirill Bulatov
c4995cfbd5 Better query api and fuzzy search 2020-12-28 15:06:10 +02:00
Kirill Bulatov
0e48cd0c3c Draft the module exclusion in modules 2020-12-28 15:06:10 +02:00
Lukas Wirth
42e3f97c30 Support labels in reference search 2020-12-24 15:40:18 +01:00
Daiki Ihara
7a2eebde22 Add initial_contents field for CreateFile 2020-12-21 15:55:40 +09:00