Commit graph

534 commits

Author SHA1 Message Date
Lukas Wirth
9e8f4d31a4 Pickup ConstReference patterns in FindUsages 2021-02-23 23:31:53 +01:00
Chetan Khilosiya
eb6cfa7f15 7526: Renamed create ssr to ide_ssr. 2021-02-23 00:59:16 +05:30
Chetan Khilosiya
e4756cb4f6 7526: Rename crate assists to ide_assists. 2021-02-23 00:59:16 +05:30
bors[bot]
62bc753f8b
Merge #7732
7732: Don't lower TypeBound::Lifetime as GenericPredicate::Error r=flodiebold a=Veykril

Basically we just discard the typebound for now instead when lowering to `GenericPredicate`. I think this shouldn't have any other side effects?

Fixes #7683(hopefully for real this time)

I also played around with introducing `GenericPredicate::LifetimeOutlives` and `GenericPredicate::TypeOutlives`(see b9d6904845) but that won't fix this issue(at least not for now) due to lifetime predicate mismatches when resolving methods so I figure this is a good way to fix it for now.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-20 20:17:14 +00:00
Lukas Wirth
9e5192d917 Don't lower TypeBound::Lifetime as GenericPredicate::Error 2021-02-20 19:08:20 +01:00
Laurențiu Nicola
4c589aded0 Remove documentation of obsolete extend selection command 2021-02-20 17:18:53 +02:00
Aleksey Kladov
3db64a400c rename completion -> ide_completion
We don't have completion-related PRs in flight, so lets do it
2021-02-17 17:53:31 +03:00
bors[bot]
4054525c41
Merge #7699
7699: Implement ast::AstNode for NameLike and move it to node_ext r=matklad a=Veykril

With this `search`(and 2 other modules) don't necessarily go through 3 calls of `find_node_at_offset_with_descend` to find the correct node. Also makes the code that searches for NameLikes a bit easier on the eyes imo, though that can be fixed with just a helper function as well so its not that relevant.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-17 13:45:27 +00:00
bors[bot]
056601b41f
Merge #7705
7705: Show hover info of the definition of ConstReference patterns instead of its type r=Veykril a=Veykril

Closes #7671
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-17 13:17:15 +00:00
Lukas Wirth
51dda8ea8e Show hover info of the definition of ConstReference patterns instead of its type 2021-02-17 14:14:58 +01:00
Paco Soberón
e0eb80eaee Allow comments between newlines in chaining hints 2021-02-17 00:09:56 +01:00
Lukas Wirth
e52bdc55ef Implement ast::AstNode for NameLike and move it to node_ext 2021-02-16 19:27:08 +01:00
bors[bot]
c9672a0539
Merge #7657
7657: utf8 r=matklad a=matklad

- Prepare for utf-8 offsets
- reduce code duplication in tests
- Make utf8 default, implement utf16 in terms of it
- Make it easy to add additional context for offset conversion
- Implement utf8 offsets

closes #7453

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-02-16 16:34:22 +00:00
Aleksey Kladov
95209aa3f8 Make utf8 default, implement utf16 in terms of it 2021-02-16 19:17:32 +03:00
Aleksey Kladov
2cb4ac9eb4 Prepare for utf-8 offsets 2021-02-16 19:17:32 +03:00
kjeremy
f9bb398cc5 Fix a few clippy::perf warnings 2021-02-16 10:55:34 -05:00
ivan770
66de90b85a
Actually fix runnable order 2021-02-15 16:09:50 +02:00
bors[bot]
a0322defc3
Merge #7656
7656: Implement constructor usage search for almost all items r=matklad a=Veykril

This PR moves the filering for enum constructors to the HIR, with this unprefixed variants as well as when the enum has been renamed via use will then still show up properly.
We now walk the ast of the `NameRef` up until we find a `PathExpr`(which also handles `CallExpr` for tuple-type structs and variants already) or a `RecordExpr`. For enum search we then take the `path` out of that expression and do a resolution on it to compare it with the definition enum.
With this PR we now support searching for all constructor literals, Unit-, Tuple- and Record-Structs, Unit-, Tuple- and Record-Variants as well as Unions.

There is one shortcoming due to how the search is triggered. Unit Variants constructors can't be searched as we have no position for it to kick off the search(since a comma doesn't have to exist for the last variant).

Closes #2549 though it doesn't implement it as outlined in the issue since the reference kind was removed recently, though I believe the approach taken here is better personally.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-14 16:17:03 +00:00
bors[bot]
63c5c92856
Merge #7668
7668: Finalize rename infra rewrite r=matklad a=Veykril

This should be the final PR in regards to rewriting rename stuff, #4290.

It addresses 3 things:
	- Currently renaming import aliases causes some undesired behavior(see #5198) which is why this PR causes us to just return an error if an attempt at renaming an alias is made for the time being. Though this only prevents it from happening when the alias import is renamed, so its not too helpful.
	- Fixes #6898
	- If we are inside a macro file simply rename the input name node as there isn't really a way to do any of the fancy shorthand renames and similar things as for that we would have to exactly know what the macro generates and what not.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-14 15:29:00 +00:00
Lukas Wirth
7b64622780 Don't rename field record patterns directly 2021-02-13 23:47:21 +01:00
Lukas Wirth
403a63d2b4 Don't classify attribute macros as their path unless it's a function with the proc_macro_attribute attribute 2021-02-13 22:11:31 +01:00
Lukas Wirth
9b04506924 Fallback to renaming input NameRef node for macros when inside macro 2021-02-13 21:41:04 +01:00
Lukas Wirth
1901172841 Prevent aliases from being renamed for now 2021-02-13 20:49:04 +01:00
ivan770
4c2b201b7d
Make annotations tests similar to those in runnables 2021-02-13 19:18:13 +02:00
Lukas Wirth
8ac6041bcf Only use HIR when searching for enum constructors, otherwise fall back to AST 2021-02-13 17:57:14 +01:00
ivan770
ee049b256a
Improve runnable annotations order, fix incorrect ignore detection 2021-02-13 15:47:53 +02:00
ivan770
c46b32c449
Added annotation tests 2021-02-13 15:27:04 +02:00
ivan770
02ad828c6d
Fix incorrect references annotation 2021-02-13 13:22:12 +02:00
ivan770
185da286d2
Moved CodeLens to ide crate 2021-02-13 13:07:47 +02:00
Lukas Wirth
c395dd1032 Implement constructor usage search for almost all items
For all struct kinds, unions and enums, as well as for record- and
tuple-variants but not for unit-variants, as these have no trailing
character we can anchor the search to. Functionality wise it is
implemented though.
2021-02-12 21:30:55 +01:00
Lukas Wirth
fd6cf4d566 Update references test output 2021-02-12 19:00:37 +01:00
Lukas Wirth
c5be0b2589 Use NameLike in FileReference directly as its not exported from ide anymore 2021-02-12 18:58:29 +01:00
Lukas Wirth
d644728d82 Refactor reference searching to work with the ast 2021-02-12 18:58:28 +01:00
Lukas Wirth
43ccbf4360 Remove unused ReferenceSearchResult functions 2021-02-12 18:58:28 +01:00
bors[bot]
dee5aba43a
Merge #7644
7644: Primitive completion r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7642

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-02-12 13:18:30 +00:00
Jonas Schievink
70f388cedb Pin Rust to 1.49.0 on CI 2021-02-12 13:05:56 +01:00
Jonas Schievink
216dc856c5 Wrap BuiltinType in code model 2021-02-11 19:52:33 +01:00
Jonas Schievink
244d8e37f1 Update fixed tests 2021-02-10 14:48:52 +01:00
Lukas Wirth
a195711df0 Resolve TupleStructPat in SourceAnalyzer::resolve_path 2021-02-10 09:37:22 +01:00
Aleksey Kladov
61f15b72ac Add parsing benchmark 2021-02-09 21:52:34 +03:00
Aleksey Kladov
4b1279d0b1 Infra for "unit" benchmarking 2021-02-09 20:25:39 +03:00
Aleksey Kladov
9ea2c96ddd restore accidentally deleted test 2021-02-09 18:29:15 +03:00
Aleksey Kladov
ef8f38efc6 More precise navigation to parent 2021-02-09 18:21:09 +03:00
Aleksey Kladov
2ac20b05f1 Cleanup tests 2021-02-09 18:13:11 +03:00
Aleksey Kladov
2dc67c85b9 Cleanup test 2021-02-09 17:48:25 +03:00
Aleksey Kladov
5ddfde3038 Modernize tests 2021-02-09 17:23:35 +03:00
Aleksey Kladov
7022ea52b5 AdtDef -> Adt 2021-02-07 14:15:02 +03:00
Lukas Wirth
34d5d77cfa Increase Highlights highlight range to covering element 2021-02-04 11:37:14 +01:00
lumenian
cafaab8b96 Show alias underlying type 2021-02-02 17:47:56 +03:00
Lukas Wirth
999e020da2 Return inner attributes of outline mod declarations in attrs_query 2021-01-31 19:53:01 +01:00