Commit Graph

262 Commits

Author SHA1 Message Date
Mohammad Mustakim Ali
2c761048d4
fix: clippy 2024-02-13 10:11:17 +00:00
Mohammad Mustakim Ali
0af14ef8c3 chore: optimise 2024-02-12 23:11:06 +00:00
Mohammad Mustakim Ali
24a3c42bd6 feat: completion list suggests constructor like & builder methods first 2024-02-12 22:34:59 +00:00
bors
cf8733353d Auto merge of #16540 - Veykril:macro-arg, r=Veykril
internal: macro_arg query always returns a TokenTree
2024-02-12 16:32:40 +00:00
Lukas Wirth
2fa57d90bc internal: macro_arg query always returns a TokenTree 2024-02-12 17:19:41 +01:00
Tavo Annus
125791386d Cleanup term search related changes 2024-02-11 14:35:54 +02:00
Tavo Annus
88964c0b6a Optionally disable term search for autocompletion 2024-02-11 13:33:29 +02:00
Tavo Annus
0b838e3e23 Expand target for autocompletion 2024-02-11 13:33:29 +02:00
Tavo Annus
a946970e2d Add quantified trees to reduce autocomplete options 2024-02-11 13:33:29 +02:00
Tavo Annus
bdbdd83ec1 Initial version of term_search for autocomplete 2024-02-11 13:33:29 +02:00
bors
1ef7a2329b Auto merge of #16525 - Veykril:item-loc, r=Veykril
Abstract more over ItemTreeLoc-like structs

Allows reducing some code duplication by using functions generic over said structs. The diff isn't negative due to me adding some additional impls for completeness.
2024-02-10 10:47:37 +00:00
Lukas Wirth
2ebf0c87c2 Deduplicate some code 2024-02-10 01:51:22 +01:00
Tetsuharu Ohzeki
f4a4b6681b ide-completion: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Lukas Wirth
15bffe25bd feat: Add break and return postfix keyword completions 2024-02-08 14:56:10 +01:00
Laurențiu Nicola
2c4152847a Add lete to postfix completion list 2024-02-06 13:13:51 +02:00
bors
3e47532dd4 Auto merge of #16474 - davidbarsky:david/import-on-the-fly-improvements, r=lnicola
internal: even more `tracing`

As part of profiling completions, I added some additional spans and moved `TyBuilder::subst_for_def` closer to its usage site (the latter had a small impact on completion performance. Thanks for the tip, Lukas!)
2024-02-05 09:01:58 +00:00
David Barsky
f9bef39d48 internal: add some more tracing spans inside of hir-ty 2024-02-01 16:10:32 -05:00
bors
850ba2fb63 Auto merge of #16451 - Urhengulas:satisfy-clippy, r=Veykril
internal: Work through temporarily allowed clippy lints, part 2

Another follow-up to https://github.com/rust-lang/rust-analyzer/pull/16401.
2024-02-01 14:23:18 +00:00
clubby789
a1fdb876c3 Remove abi_amdgpu_kernel references 2024-01-31 19:06:10 +00:00
Johann Hemmann
f15ee8a380 unnecessary_filter_map 2024-01-31 19:06:18 +01:00
Johann Hemmann
386d438e17 skip_while_next 2024-01-31 19:06:18 +01:00
bors
355c9444e1 Auto merge of #16448 - Young-Flash:typos, r=lnicola
minor: correct typos

I use [crate-ci/typos](https://github.com/crate-ci/typos) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos) (with Apache-2.0, MIT licenses).

BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md) as white list for some intentional typos
2024-01-31 13:29:55 +00:00
David Barsky
e1ea7c8844 internal: switch to tracing from log
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
bors
63123ab408 Auto merge of #16417 - davidsemakula:normalize-use-trees, r=Veykril
feat: "Normalize import" assist and utilities for normalizing use trees

- Add import/use tree normalization utilities
- Add "normalize import" assist
- Update "merge imports" assist to always apply to the covering use item except for nested use tree selections
- Update "merge imports" assist to avoid adding unnecessary braces when merging nested use tree selections

See [this discussion](https://github.com/rust-lang/rust-analyzer/pull/16372#discussion_r1457244321) for the motivation for the new "normalize import" assist and changes to the "merge imports" assist.
2024-01-30 14:55:08 +00:00
Young-Flash
db9fd370ee minor: correct typos 2024-01-30 21:43:43 +08:00
davidsemakula
8fab92feb2 normalize use trees when merging imports 2024-01-28 11:55:01 +03:00
Alain Siegrist
7ec32d091a Remove letelse control flow snippets 2024-01-27 14:35:22 +01:00
Alain Siegrist
51d57b9bb6 Make return a snippet 2024-01-27 14:35:22 +01:00
Alain Siegrist
57934ac47a Add postfix completion for let else 2024-01-27 14:35:22 +01:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Johann Hemmann
b1a0c9ac40 single_match 2024-01-19 18:31:15 +01:00
Johann Hemmann
71d4dba960 redundant_pattern_matching 2024-01-19 17:31:01 +01:00
Johann Hemmann
add40c8660 match_like_matches_macro 2024-01-19 17:31:01 +01:00
Johann Hemmann
4184c6af0d collapsible_match 2024-01-19 17:31:00 +01:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
bors
1ab8c7fd27 Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril
fix: add error recovery for use_tree_list parsing

This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly.

before

![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/c6643690-f25c-4ad9-93d9-e661ba5b1dc3)

after

![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/30a58c40-2711-48d2-b2e5-fb208fc8636c)

close https://github.com/rust-lang/rust-analyzer/issues/16227
2024-01-18 09:52:37 +00:00
Young-Flash
1c61326ca0 add use_tree_completion test 2024-01-18 17:35:01 +08:00
Lukas Wirth
83591268ab minor: Make use of some new SmolStr improvements 2024-01-17 13:47:15 +01:00
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
Lukas Wirth
cc2b79feeb internal: Speed up import searching some more 2024-01-05 12:58:20 +01:00
Lukas Wirth
4f75e0f910 Remove completion limit for trait importing method completions 2024-01-05 12:03:08 +01:00
Lukas Wirth
2666349392 Remove limit from symbol_index::Query 2024-01-04 19:20:10 +01:00
bors
86e559bf3f Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy

This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html).

By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00
Luiz Carvalho
9a36bc393d
fix(completion): render fn type 2024-01-02 10:30:16 -03:00
Luiz Carvalho
ed216e285d
fix(completion): make the expected type a tad smarter with Fns
This commit changes how the expected type is calculated when working
with Fn pointers, making the parenthesis stop vanishing when completing
the function name.

I've been bugged by the behaviour on parenthesis completion for a long
while now. R-a assumes that the `LetStmt` type is the same as the
function type I've just written. Worse is that all parenthesis vanish,
even from functions that have completely different signatures. It will
now verify if the signature is the same.

While working on this, I noticed that record fields behave the same, so
I also made it prioritize the field type instead of the current
expression when possible, but I'm unsure if this is OK, so input is
appreciated.

ImplTraits as return types will still behave weirdly because lowering is
disallowed at the time it resolves the function types.
2024-01-02 10:28:49 -03:00
bors
60fe5fd98d Auto merge of #16049 - dfireBird:followup-callable-fields, r=Veykril
fix: make callable fields not complete in method access no parens case

Follow up PR for #15879

Fixes the callable field completion appearing in the method access with no parens case.
2024-01-02 10:20:31 +00:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
bors
afbb8f31ff Auto merge of #16184 - Veykril:completion-panic, r=Veykril
fix: Fix completions analysis not caching all nodes in Semantics

Fixes https://github.com/rust-lang/rust-analyzer/issues/16161
2023-12-22 12:13:46 +00:00
Lukas Wirth
91046e9e45 fix: Fix completions analysis not caching all nodes in Semantics 2023-12-22 13:01:48 +01:00