Commit Graph

18796 Commits

Author SHA1 Message Date
dfireBird
257870e09f
add tests to verify relevance of notable traits and some refactors 2024-01-10 16:30:22 +05:30
dfireBird
df5c647982
add notable_trait predicate to CompletionRelevance
implement the predicate set on the case function from traits
2024-01-08 20:34:11 +05:30
bors
6ce3f44597 Auto merge of #16298 - riverbl:exclusive-range-hint, r=Veykril
feat: Add inlay hint for exclusive ranges

Adds an inlay hint containing a '<' character to exclusive range expressions and patterns that specify an upper bound.

![2024-01-07-095056_257x415_scrot](https://github.com/rust-lang/rust-analyzer/assets/94326797/d6bbc0de-52a5-4af4-b53c-a034749b6cab)

Inspired by [this comment](https://github.com/rust-lang/rust/issues/37854#issuecomment-1865124907) noting that IntelliJ Rust has this feature.
2024-01-07 10:21:39 +00:00
riverbl
3c378b9c70 Add inlay hint for exclusive ranges
Adds an inlay hint containing a '<' character to exclusive range expressions and patterns that specify an upper bound.
2024-01-07 09:33:56 +00:00
Matthias Krüger
3fb2cd2002 autofix remaining perf findings 2024-01-07 01:20:20 +01:00
Matthias Krüger
196650dfaf don't to_string() format args 2024-01-07 01:11:57 +01:00
Matthias Krüger
b22bd36f6e remove more redundant clones manually 2024-01-07 00:26:49 +01:00
Matthias Krüger
476e10e961 remove redundant clones 2024-01-07 00:17:48 +01:00
bors
f595e60b6d Auto merge of #16290 - Veykril:chalk, r=Veykril
internal: Reduce vec cloning in mir lowering/eval
2024-01-06 22:13:09 +00:00
bors
e9ae0b7ab4 Auto merge of #16285 - lnicola:repr-packed-unaligned, r=Veykril
fix: Fix panic on unaligned packed attribute

Closes #16284
2024-01-06 20:35:56 +00:00
Lukas Wirth
5ac0c14384 Remove some vec clones in const-eval 2024-01-06 21:33:47 +01:00
Laurențiu Nicola
d17156a774 Add some repr(packed) tests 2024-01-06 21:24:01 +02:00
bors
f8eab9b7d2 Auto merge of #16279 - Veykril:ide-tuple-fields, r=Veykril
feat: IDE features for primitive tuple fields

Fixes https://github.com/rust-lang/rust-analyzer/issues/13018
2024-01-06 18:30:10 +00:00
Laurențiu Nicola
30e17e377c Fix panic on unaligned packed attribute 2024-01-06 19:54:57 +02:00
Lukas Wirth
5125063a21 Remove unnecessary cloning 2024-01-06 17:48:07 +01:00
Lukas Wirth
c9c4053eed More aliases 2024-01-06 16:58:15 +01:00
Lukas Wirth
963568b46f feat: IDE features for primitive tuple fields 2024-01-06 15:04:58 +01:00
bors
e53792b7cb Auto merge of #16256 - Urhengulas:ide-runnables-assert_eq, r=Veykril
internal: Only compare relevant parts in  `ide::{runnables,inlay_hints}` tests

This PR limits the data being compared. Therefore the tests should be more readable, as well as being more robust to changes to the data structure.

Part of https://github.com/rust-lang/rust-analyzer/issues/14268.
2024-01-05 13:49:30 +00:00
bors
2271b82007 Auto merge of #16264 - roife:refactor/refactor-generate-delegate-trait, r=Veykril
internal: clean and enhance readability for `generate_delegate_trait`

Continue from #16112

This PR primarily involves some cleanup and simple refactoring work, including:

- Adding numerous comments to layer the code and explain the behavior of each step.
- Renaming some variables to make them more sensible.
- Simplify certain operations using a more elegant approach.

The goal is to make this intricate implementation clearer and facilitate future maintenance.

In addition to this, the PR also removes redundant `path_transform` operations for `type_gen_args`.
Taking the example of `impl Trait<T1> for S<S1>`, where `S1` is considered. The struct `S` must be in the file where the user triggers code actions, so there's no need for the `path_transform`. Furthermore, before performing the transform, we've already renamed `S1`, ensuring it won't clash with existing generics parameters. Therefore, there's no need to transform it.
2024-01-05 13:37:54 +00:00
bors
59457091bb Auto merge of #16199 - Young-Flash:extract_struct_with_Self, r=Veykril
fix: `extract_struct_from_enum_variant` assist should resolve Self generic arg

close https://github.com/rust-lang/rust-analyzer/issues/16197
2024-01-05 13:26:34 +00:00
bors
2980d54160 Auto merge of #16223 - Young-Flash:quickfix_redundant_assoc_item, r=Veykril
feat: add quickfix for redundant_assoc_item diagnostic

Happy New Year 😊

follow up https://github.com/rust-lang/rust-analyzer/pull/15990, now it's time to close https://github.com/rust-lang/rust-analyzer/issues/15958, closes https://github.com/rust-lang/rust-analyzer/issues/16269

![demo](https://github.com/rust-lang/rust-analyzer/assets/71162630/74022c52-1566-49a0-9be8-03b82f3e730f)

EDIT: add a demo.git would be more illustrated when making release change log.
2024-01-05 13:15:01 +00:00
bors
af102bab0e Auto merge of #16270 - Veykril:flyimport-perf, r=Veykril
internal: Speed up import searching some more

Pushes the sorting to the caller, meaning additional filtering can be done pre-sorting. Similarly a collect call was pushed to the caller for allowing some other filters to run pre-collecting.
2024-01-05 12:03:02 +00:00
Lukas Wirth
cc2b79feeb internal: Speed up import searching some more 2024-01-05 12:58:20 +01:00
bors
dc31cef5fc Auto merge of #16268 - Veykril:method-trait-completion-limit, r=Veykril
Remove completion limit for trait importing method completions

Fixes https://github.com/rust-lang/rust-analyzer/issues/16075

The < 3 char limit never applied to methods and the amount of completions generated due this is not absolutely massive as not all traits in a project are ever applicable so there is little reason to employ the limit here. Especially as it limits the number of traits we consider, not items (after my changes yesterday), and the number of traits is not the slowing factor here. Tested this in r-a where we have ~800 traits project wide and even when ~260 are applicable there was no noticable slow down from it.
2024-01-05 11:14:37 +00:00
Lukas Wirth
4f75e0f910 Remove completion limit for trait importing method completions 2024-01-05 12:03:08 +01:00
bors
11b0126679 Auto merge of #16267 - Veykril:import-map-fix, r=Veykril
internal: Deduplicate some code
2024-01-05 10:43:52 +00:00
Lukas Wirth
d60638e5e6 Deduplicate some code 2024-01-05 11:34:18 +01:00
roife
fbdc59c54a internal: remove unnecessary path_tranform on type_gen_args in generate_delegate_trait. 2024-01-05 13:59:44 +08:00
roife
bf0c4acef4 internal: refactor generate_delegate_trait and add comments 2024-01-05 13:59:34 +08:00
bors
c84352a346 Auto merge of #16261 - Veykril:import-map-fix, r=Veykril
internal: Move query limits to the caller

Prior we calculated up to `limit` entries from a query, then filtered from that leaving us with less entries than the limit in some cases (which might give odd completion behavior due to items disappearing). This changes it so we filter before checking the limit.
2024-01-04 18:27:38 +00:00
Lukas Wirth
2666349392 Remove limit from symbol_index::Query 2024-01-04 19:20:10 +01:00
Lukas Wirth
0af780ea3e Fix symbol_index::Query::search_maps not adhering to case-sensitivity correctly 2024-01-04 19:12:56 +01:00
Johann Hemmann
f8ff4fb75b Conditionally include use_name_in_title and cfg 2024-01-04 18:47:08 +01:00
bors
a795f4836c Auto merge of #16260 - Urhengulas:ide-diagnostics-refactor-tests, r=lnicola
internal: Replace only occurence of `check_expect` with `check_diagnostics`

Part of https://github.com/rust-lang/rust-analyzer/issues/14268.
2024-01-04 17:24:57 +00:00
Johann Hemmann
03b1ecd90d Replace only occurence of check_expect with check_diagnostics 2024-01-04 18:20:38 +01:00
Lukas Wirth
c3a29e5528 Remove limit from import_map::Query 2024-01-04 18:12:25 +01:00
Johann Hemmann
61b552124a Move check_expect and check_expect_clear_loc to inlayhints::chaining 2024-01-04 17:32:16 +01:00
bors
e88788ea70 Auto merge of #16258 - Veykril:import-map-fix, r=Veykril
internal: Rewrite `ImportMap::search_dependencies`

Second attempt, this time with a lot of perf improvements

Fixes https://github.com/rust-lang/rust-analyzer/issues/16080
Fixes https://github.com/rust-lang/rust-analyzer/issues/16074
Fixes https://github.com/rust-lang/rust-analyzer/issues/15845

The main bottleneck for flyimport completions are now import path calculation and completion item rendering.
2024-01-04 16:29:25 +00:00
Johann Hemmann
594e0a5de6 Only compare range and label 2024-01-04 17:29:20 +01:00
Lukas Wirth
9b3052104c internal: Rewrite ImportMap::search_dependencies 2024-01-04 17:26:00 +01:00
Johann Hemmann
dbeb27e05d Refactor check 2024-01-04 16:10:34 +01:00
Johann Hemmann
971fc1b3e8 Also compare navigation targets for tests 2024-01-04 15:21:57 +01:00
Johann Hemmann
9bc005a3bf Only iterate through runnables once 2024-01-04 15:14:05 +01:00
Johann Hemmann
3f8083fc81 Only compare navigation targets 2024-01-04 15:14:05 +01:00
Johann Hemmann
f3770c14cf Compare test ids instead of names, seems more robust 2024-01-04 15:14:05 +01:00
Johann Hemmann
e9632bd48b Only compare test name 2024-01-04 15:14:05 +01:00
bors
a2aab001a7 Auto merge of #16241 - Nilstrieb:sysrooting, r=Veykril
Give a userful error when rustc cannot be found in explicit sysroot

Somehow r-a believed that my sysroot was something weird with no rustc. Probably a me issue, but it was impossible to diagnose since r-a just gave me a plain "No such file or directory". Adding this error makes it clear what happened and allows diagnosing the problem.
2024-01-04 14:10:57 +00:00
Johann Hemmann
656ac104c9 Do not extract FileId for file_system_edits 2024-01-04 14:29:41 +01:00
Johann Hemmann
ea675ab888 Insert newline at the end 2024-01-04 14:01:03 +01:00
Johann Hemmann
f2b872a3c5 Switch to Vec, because we do want to have duplicate keys 2024-01-04 14:01:03 +01:00