Commit graph

539 commits

Author SHA1 Message Date
Lukas Wirth
295f0c57a5 Revert #11912 as it parses all visited files 2022-04-09 13:41:06 +02:00
Jonas Schievink
cdeb6140bf Account for macros in get_missing_assoc_items 2022-04-08 18:05:34 +02:00
Lukas Wirth
4e6390bb12 Fix SearchScope::reverse_dependencies trying to search more files than necessary 2022-04-06 14:24:06 +02:00
Lukas Wirth
d9f6cee100 fix: Fix SearchScope using incorrect text ranges for macro-emitted inline modules 2022-04-06 13:58:40 +02:00
Jonas Schievink
872b7b9660 Wrap macros in expr position in MacroExpr node 2022-04-05 17:43:34 +02:00
bors[bot]
46d7ee68f2
Merge #11865
11865: Fix: Select correct insert position for disabled group import r=jonasbb a=jonasbb

The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.

This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).

Tests are updated and two tests (empty module and inner attribute) are
added.

Fixes #11585

Co-authored-by: Jonas Bushart <jonas@bushart.org>
2022-04-03 18:46:45 +00:00
Jonas Bushart
156f9074e1 Use check_count! instead of multiple check! in separate scopes
Changes are based on the review feedback by Veykril.
2022-04-03 18:34:06 +00:00
Jonas Bushart
0cc079f3e9 Merge test functions using the same coverage marks to avoid parallelism 2022-04-03 12:01:11 +00:00
bors[bot]
ba9aed19c7
Merge #11877
11877: fix: splitting path of a glob import wrongly adds `self` r=Veykril a=iDawer

Close  #11703 

`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2022-04-02 22:12:59 +00:00
iDawer
c8c21aabff fix: merge_imports::recursive_merge exiting early 2022-04-02 14:18:42 +05:00
Lukas Wirth
c290e68ff9 internal: Remove PathResolution::AssocItem 2022-04-01 18:32:05 +02:00
iDawer
b4c608896c fix: splitting path of a glob import wrongly adds self
`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).
2022-04-01 19:12:50 +05:00
Jonas Bushart
c039810b16 Fix: Select correct insert position for disabled group import
The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.

This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).

Tests are updated and two tests (empty module and inner attribute) are
added.

Fixes #11585
2022-03-31 18:15:01 +00:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Lukas Wirth
ef92453dfe internal: Refactor FamousDefs builtin crate search 2022-03-30 22:23:54 +02:00
bors[bot]
652233283b
Merge #11791
11791: fix: some fixes and improvements to signature help r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-23 00:36:11 +00:00
bors[bot]
c2ea378920
Merge #11795
11795: fix: Correctly suggest auto importing traits from aliases r=Veykril a=unexge

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

Co-authored-by: unexge <unexge@gmail.com>
2022-03-22 21:44:06 +00:00
unexge
4e4c9ea4ac fix: Correctly suggest auto importing traits from aliases 2022-03-22 22:30:29 +01:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Jonas Schievink
4e07864f59 signature help: skip lifetimes when non-lifetime arguments are present 2022-03-22 16:44:27 +01:00
Jonas Schievink
4bb5df0ce5 Avoid signature help inside multiline expressions
Fixes #11768
2022-03-22 16:08:46 +01:00
Lukas Wirth
7370a6b5b8 fix: Fix flyimport showing functions in pattern position 2022-03-21 19:41:39 +01:00
bors[bot]
fedf724d82
Merge #11774
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril

as long as they aren't inside an unsafe block inside the macro that is.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:15:29 +00:00
Lukas Wirth
68de7b30e0 feat: Tag macro calls as unsafe if they expand to unsafe expressions 2022-03-20 19:07:44 +01:00
Jonas Schievink
0642724e94 Provide signature help when editing generic args 2022-03-18 19:59:41 +01:00
bors[bot]
6ad8c022ed
Merge #11750
11750: fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11746
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-18 11:13:37 +00:00
Lukas Wirth
828196be3b fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros 2022-03-18 12:01:59 +01:00
Laurențiu Nicola
be6d5001e4 Bump xshell and fix dist 2022-03-17 08:53:33 +02:00
Aleksey Kladov
56e43c34e7 ⬆️ xshell 2022-03-14 14:57:24 +00:00
Matthias Krüger
56e4ea59d9 more clippy fixes:
clippy::match_like_matches_macro
clippy::to_string_in_format_args
clippy::single_char_add_str
clippy::filter_map_identity
clippy::clone_on_copy
clippy::useless_format
clippy::unused_unit
2022-03-12 16:50:49 +01:00
Matthias Krüger
21ffc5350d fix clippy::redundant_clone 2022-03-12 16:50:49 +01:00
Matthias Krüger
d64d711db2 fix clippy::map_flatten 2022-03-12 16:50:49 +01:00
Matthias Krüger
62ed658311 fix clippy::useless_conversion 2022-03-12 16:50:49 +01:00
Matthias Krüger
451fcd3c79 fix clippy::redundant_closure 2022-03-12 16:50:49 +01:00
Matthias Krüger
1f70886b15 fix clippy::single_char_pattern 2022-03-12 16:50:49 +01:00
Matthias Krüger
7912e33ed6 fix clippy::needless_borrow 2022-03-12 16:50:49 +01:00
Lukas Wirth
a8b76b632c Expand into pseudo-derive attribute expansions in completions 2022-03-10 20:53:50 +01:00
Lukas Wirth
533f178a52 minor: Access parser internals through ide_db for ide crates 2022-03-10 17:07:28 +01:00
Lukas Wirth
f9c8646d89 fix symbol index collection not collecting legacy macros 2022-03-09 01:44:20 +01:00
Lukas Wirth
c37fe779c6 Add data queries for macros 2022-03-09 00:41:54 +01:00
Lukas Wirth
eba90936c1 Move ide crates to new hir::Macro 2022-03-08 23:52:26 +01:00
Lukas Wirth
ab21cf2f4f internal: Re-arrange ide_db modules 2022-03-06 19:04:04 +01:00
Lukas Wirth
c1f91c93b2 minor: Simplify 2022-03-06 17:56:02 +01:00
Lukas Wirth
97076c074d internal: Simplify and optimize syntax_highlighting 2022-03-06 03:49:54 +01:00
Lukas Wirth
5c0aee013e Fix highlighting of Self 2022-03-05 23:34:37 +01:00
Lukas Wirth
c0d6471143 fix: Recognize Self as a proper keyword 2022-03-05 23:20:06 +01:00
bors[bot]
8f504dc873
Merge #11598
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2

Part of #11532.

Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
    let (<gensym_a>, <gensym_b>) = (b, a);
    a = <gensym_a>;
    b = <gensym_b>;
}
```

rustc uses hygiene to implement that, but we don't support hygiene yet.

However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.

I'm still looking for the best way to do lowering, though.

Fixes #11454.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-03-05 11:31:29 +00:00
Lukas Wirth
32bf7af83e Support locals with multiple declaration sites 2022-03-04 19:49:08 +01:00
hkalbasi
4fa8749c44 Preserve order of generic args 2022-03-04 11:46:14 +03:30
Chayim Refael Friedman
d9f0731bd2 Parse destructuring assignment
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
2022-03-02 01:51:25 +00:00