Commit Graph

9664 Commits

Author SHA1 Message Date
Benjamin Coenen
52bce6bf5d Delete optional arg for inline attr and add doc alias attr completion #7167
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-18 20:50:45 +01: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
Kirill Bulatov
f01cfe9114 Small token fix
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-18 21:30:04 +02:00
Lukas Wirth
21a6384ce6 Remove obsolete RangeInfo usage in rename 2021-01-18 20:28:20 +01:00
Jonas Schievink
57a82fb05b Rename CrateDefMap to DefMap 2021-01-18 20:18:05 +01:00
Lukas Wirth
b26002410b Parse impl const Trait 2021-01-18 20:18:02 +01:00
bors[bot]
39282ec419
Merge #7332
7332: Rename reference search uses ide_db::search directly r=matklad a=Veykril

https://github.com/rust-analyzer/rust-analyzer/pull/7251#discussion_r556644241

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:00:04 +00:00
Jonas Schievink
9b5fa1c61a Add back jemalloc support 2021-01-18 19:39:46 +01:00
kjeremy
a8b984185b cargo update
Update test_serialize_proc_macro for new serde version
2021-01-18 13:13:24 -05:00
Lukas Wirth
6015a66cae Make rename reference search use ide_db::search directly 2021-01-18 18:57:59 +01:00
bors[bot]
a1c72451bb
Merge #7331
7331: shrink_to_fit `TokenMap`'s backing storage r=jonas-schievink a=jonas-schievink

Reduces `HygieneFrameQuery`'s memory usage by like 10 MB or so

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-18 17:49:52 +00:00
bors[bot]
fcc109e890
Merge #7326
7326: Use `is_ident` when converting Path to an Identifier r=edwin0cheng a=kevaundray



Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
2021-01-18 17:40:11 +00:00
Jonas Schievink
2d799cf5e0 shrink_to_fit TokenMap's backing storage 2021-01-18 18:40:06 +01:00
bors[bot]
9210f480ac
Merge #7329
7329: Add test for reference search on self declaration param r=Veykril a=Veykril

Closes #7316

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 17:24:48 +00:00
Lukas Wirth
22b9b9abe7 Add test for reference search on self declaration param 2021-01-18 18:21:40 +01:00
bors[bot]
6105dbfc2e
Merge #7327
7327: Remove `item_tree::Expr` r=jonas-schievink a=jonas-schievink

It's empty and unused

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-18 17:11:38 +00:00
Jonas Schievink
6f4f285f37 Remove item_tree::Expr
It's empty and unused
2021-01-18 18:05:40 +01:00
Kevaundray Wedderburn
da104bb0f5 cargo fmt 2021-01-18 16:58:29 +00:00
Jonas Schievink
872bf09381 Add MacroType syntax 2021-01-18 17:56:35 +01:00
Kevaundray Wedderburn
725c20e8c5 use is_ident method 2021-01-18 16:54:07 +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]
cc58459ee3
Merge #7323
7323: Minor r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-18 13:11:37 +00:00
Aleksey Kladov
738cf7d495 Minor 2021-01-18 16:09:44 +03:00
Aleksey Kladov
a60168e674 Use assert_never properly 2021-01-18 15:58:10 +03:00
bors[bot]
1f53026997
Merge #7320
7320: Enable serde_json unbounded_depth feature r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-18 12:05:39 +00:00
Laurențiu Nicola
d6b3dc1a6f Enable serde_json unbounded_depth feature 2021-01-18 14:04:20 +02:00
Aleksey Kladov
add87f5424 Avoid blocking the main loop when editing Cargo.toml
I've noticed a bunch of "main loop too long" warnings in console when
typing in Cargo.toml. Profiling showed that the culprit is `rustc
--print cfg` call.

I moved it to the background project loading phase, where it belongs.
This highlighted a problem: we generally use single `cfg`, while it
really should be per crate.
2021-01-18 14:52:12 +03:00
Aleksey Kladov
cc963d2b11 Add profile call 2021-01-18 14:01:52 +03:00
bors[bot]
5e6e890947
Merge #7317
7317: Add profile call r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-18 10:30:43 +00:00
Aleksey Kladov
e13065b8ac Add profile call 2021-01-18 13:30:12 +03: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
Aleksey Kladov
b97447b125 Add missing inlines 2021-01-17 16:50:03 +03:00
Aleksey Kladov
0a570eddd2 Less annoying mod completion
We shouldn't complete optional elements, as deleting stuff is much more
annoying than adding it.
2021-01-17 13:18:45 +03:00
Aleksey Kladov
1c8feac01f ⬆️ arena 2021-01-17 11:43:04 +03:00
Aramis Razzaghipour
1d103cf087
Use ‘index’ terminology for arena consistently 2021-01-17 18:38:08 +11:00
bors[bot]
3224ecea87
Merge #7276
7276: Remove map module from la-arena public API r=lnicola a=arzg

It’s unlikely that more items will be added to the module, so it’s simpler for users if `ArenaMap` is re-exported and the module made private.

This doesn’t compile for the same reason that #7275 doesn’t:

> This pull request doesn’t compile because dependencies on la-arena go through crates.io, so existing dependencies on the crate are referencing an old version. As such, this PR will only compile once a new la-arena version has been published.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-01-17 07:20:36 +00:00
bors[bot]
f5f011ba71
Merge #7304
7304: Depend on local copy of la-arena instead of crates.io’s r=lnicola a=arzg

This addresses [this comment](https://github.com/rust-analyzer/rust-analyzer/pull/7276#issuecomment-760909936). #7275 and #7276 should start compiling if this is merged.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-01-17 07:05:44 +00:00
Aramis Razzaghipour
709034d123
Depend on local copy of la-arena instead of crates.io’s 2021-01-17 17:52:57 +11:00
Kirill Bulatov
d1ac3293f4 Properly resolve completion edits for empty input 2021-01-17 02:57:38 +02: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
Aleksey Kladov
b38414c7f4 When building an item-tree, keep fewer nodes in memory 2021-01-16 23:07:28 +03:00
Kirill Bulatov
db335a1bbf Add flyimport completion for trait assoc items 2021-01-16 20:44:12 +02:00
Kirill Bulatov
497fc232e7 Unindent the test 2021-01-16 19:51:42 +02:00
Kirill Bulatov
7ae1309ac5 Use specific kind for the flyimport completions 2021-01-16 19:40:59 +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
cbe9335954 Add test mark for skipping single use item 2021-01-15 22:57:10 +03:00
unexge
c303014f39 Create new nodes only when applying changes 2021-01-15 22:35:42 +03:00
unexge
a3a722de9f Add Unmerge Use assist 2021-01-15 22:14:51 +03:00
bors[bot]
8a869e870a
Merge #7288
7288: Handle self/super/crate in PathSegment as NameRef r=matklad a=Veykril

Wrapping self/super/crate in NameRef as per https://github.com/rust-analyzer/rust-analyzer/pull/7261#issuecomment-760023172



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-15 18:40:47 +00:00
Lukas Wirth
cb863390f2 Handle self/super/crate in PathSegment as NameRef 2021-01-15 19:21:23 +01:00
bors[bot]
148e3d0f6a
Merge #7287
7287: Make SyntaxPtr lookup logarithmic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-15 17:46:36 +00:00
Aleksey Kladov
26ef7e39f4 Make SyntaxPtr lookup logarithmic
closes #3934

cc https://github.com/rust-analyzer/rowan/pull/81
2021-01-15 20:40:40 +03:00
bors[bot]
92c0379560
Merge #7285
7285: Don't duplicate rustc diagnostics fixes r=matklad a=jonas-schievink

Should fix https://github.com/rust-analyzer/rust-analyzer/issues/6851

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-15 17:34:31 +00:00
bors[bot]
a8587f153b
Merge #7286
7286: Remove useless wrapper r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-15 17:16:27 +00:00
Aleksey Kladov
6dbba4d75d Remove useless wrapper 2021-01-15 20:15:33 +03:00
Jonas Schievink
36500fe496 Don't duplicate rustc diagnostics fixes 2021-01-15 18:11:54 +01:00
Daiki Ihara
138514bea2 Add test for yield_expr 2021-01-15 23:35:17 +09:00
Daiki Ihara
85cd3524e2 Add support for yiled keyword 2021-01-15 23:35:17 +09:00
Aleksey Kladov
f2ba2048d1 Insert ; when completing keywords in let 2021-01-15 15:49:59 +03:00
Aleksey Kladov
41ea260201 Simplify 2021-01-15 15:14:31 +03:00
Aleksey Kladov
9b1bc19d67 Add braces when completing ifs 2021-01-15 15:01:32 +03:00
Aramis Razzaghipour
9b5ba090db
Remove map module from la-arena public API
It’s unlikely that more items will be added to the module,
so it’s simpler for users if `ArenaMap` is re-exported
and the module made private.
2021-01-15 11:14:04 +11:00
Lukas Wirth
d5095329a1 Phase out SourceFileEdits in favour of a plain HashMap 2021-01-14 22:43:36 +01:00
Lukas Wirth
e23bfafb32 Fix assert_never invoking assert_always 2021-01-14 22:43:09 +01:00
Lukas Wirth
f51457a643 Group file source edits by FileId 2021-01-14 18:35:22 +01:00
bors[bot]
f88f3d6885
Merge #7271
7271: prepare to publish el libro de arena r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-14 16:06:30 +00:00
Aleksey Kladov
4c4e54ac8a prepare to publish el libro de arena 2021-01-14 19:06:02 +03:00
bors[bot]
540edee3cd
Merge #7270
7270: Introduce more appropriate assertion mechanism r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-14 15:27:20 +00:00
Aleksey Kladov
8dc68ecdfc Introduce more appropriate assertion mechanism
rust-analyzer is a long-running program, so we *should* handle assertion
failures.

See also https://www.sqlite.org/assert.html.
2021-01-14 18:25:19 +03:00
bors[bot]
022d031b7f
Merge #7266
7266: Make printin the backtrace more convenient r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-14 11:56:01 +00:00
Aleksey Kladov
865e05b5b4 Make printin the backtrace more convenient 2021-01-14 14:55:13 +03:00
bors[bot]
947850c2d9
Merge #7265
7265: Add a test for #7110 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-14 11:41:29 +00:00
Aleksey Kladov
dd5b3cd6f0 Add a test for #7110 2021-01-14 14:33:02 +03:00
bors[bot]
e732b948e9
Merge #7264
7264: Use --workspace when loading extern resources r=edwin0cheng a=chinedufn

https://github.com/rust-analyzer/rust-analyzer/issues/5040#issuecomment-759853153

Co-authored-by: Chinedu Francis Nwafili <frankie.nwafili@gmail.com>
2021-01-14 11:31:10 +00:00
Chinedu Francis Nwafili
47c5ec4b94
Use --workspace when loading extern resources
https://github.com/rust-analyzer/rust-analyzer/issues/5040#issuecomment-759853153
2021-01-14 06:03:41 -05:00
bors[bot]
d76143da19
Merge #7211
7211: Fixed expr meta var after path colons in mbe r=matklad a=edwin0cheng

Fixes #7207

Added `L_DOLLAR` in `ITEM_RECOVERY_SET` , but I don't know whether it is a good idea.

r? @matklad 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-14 10:52:12 +00:00
bors[bot]
d635806ea5
Merge #7257
7257: vfs documentation r=matklad a=arnaudgolfouse

This documents every item in the `vfs` crate, except for a few private, windows-specific items.

Co-authored-by: Arnaud <arnaud.golfouse@free.fr>
2021-01-14 10:13:57 +00:00
bors[bot]
184f4cbf5d
Merge #7110
7110: Deduplicate macros when offering completion r=matklad a=AdnoC

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7081

When iterating over the names within the `hir_def::resolver::Scope` for a module, track what macros are in the `hir_def::item_scope::ItemScope::legacy_macros` collection for the module. When iterating over names from the prelude, do not proccess the name if it had been in the `legacy_macros` collection.

This is implemented with a `FxHashSet` in the `Scope::process_names` function that is populated when iterating over `legacy_macros` and checked when iterating over the prelude.

Alternative implementation could instead query the `legacy_macros` `FxHashMap` directly when processing names in the prelude.

Also, I'd like to add a test for this, but I'm not sure where it could be added.

Co-authored-by: AdnoC <adam.r.cutler@gmail.com>
2021-01-14 10:00:46 +00: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
Fisher Darling
ba00bb4af9 Sort impls by trait definition
Closes #6110
2021-01-13 16:04:37 -07:00
bors[bot]
dab210d9b2
Merge #7263
7263: Use upstream TextSize API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-13 18:35:08 +00:00
Aleksey Kladov
3d78f502bd Use upstream TextSize API 2021-01-13 21:32:24 +03:00
bors[bot]
42e00032c6
Merge #7220
7220: same level folder rename for will_rename_files r=kjeremy a=ShuiRuTian

use tricky way to support folder rename.

Another step after #7009 and for #4471

Co-authored-by: ShuiRuTian <158983297@qq.com>
Co-authored-by: Song Gao <158983297@qq.com>
2021-01-13 17:40:45 +00:00
ShuiRuTian
727a7827fd fix windows test. 2021-01-13 22:56:31 +08:00
Lukas Wirth
3d6480bc31 Render Fn* trait objects and impl types as rust does 2021-01-13 13:29:47 +01:00
bors[bot]
f84f5cb0ea
Merge #7262
7262: Don't show internal server error on rename r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-13 12:09:26 +00:00
Aleksey Kladov
f0e802f490 Don't show internal server error on rename
Doesn't quite work due to https://github.com/microsoft/vscode-languageserver-node/issues/730

Note that this intentionally removes `impl std::Error for RenameError`
-- we nether want to blindly bubble the rename error.
2021-01-13 15:07:30 +03:00
ShuiRuTian
76e6589016 unwrap. 2021-01-13 12:10:45 +08:00
Arnaud
4b71c8332d Document vfs private items 2021-01-12 18:01:47 +01:00
Arnaud
311ec70d03 Document vfs public items 2021-01-12 18:01:36 +01:00
ShuiRuTian
6a15876fc4 skip slow tests. 2021-01-13 00:58:28 +08:00
ShuiRuTian
5f8fa66b77 use path rather than hard code. 2021-01-13 00:53:17 +08:00
ShuiRuTian
e1c9c9b604 fix and add tests. 2021-01-13 00:30:49 +08: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