Commit Graph

18331 Commits

Author SHA1 Message Date
Young-Flash
e0276dc5dd fix: find Self reference 2023-11-10 19:54:43 +08:00
hkalbasi
1086b294c2 update rustc dependencies 2023-11-08 01:16:47 +03:30
roife
13249b7dd9 fix: correct a typo in a comment in base-db/lib.rs 2023-11-07 14:51:34 +08:00
Young-Flash
b84940b199 make generate_mut_trait_impl assist trigged for std trait only 2023-11-05 12:27:10 +08:00
Young-Flash
8d8d12120d feat: add generate_mut_trait_impl assist 2023-11-05 12:27:10 +08:00
Laurențiu Nicola
19bf0da9d7 Fix docs path for derive macros 2023-11-04 13:33:19 +02:00
bors
11a263d5ee Auto merge of #15819 - wasd96040501:feat/skip_tt_count_limit, r=lnicola
feat: skip checking token tree count for include! macro call

fix #15335 #15648
2023-11-02 10:48:51 +00:00
luoyangze.ptrl
b76f2c8ee0 fix: using name(include) instead of str 2023-11-02 10:14:54 +08:00
luoyangze.ptrl
740a864b7c feat: skip checking tt count for include macro call 2023-11-02 00:27:11 +08:00
bors
99e94d2938 Auto merge of #15788 - Young-Flash:import_anonymously, r=lnicola
feat: import trait with alias

![import_trait_with_alias](https://github.com/rust-lang/rust-analyzer/assets/71162630/81601160-fe55-46e3-ab8d-b2705e1aa696)

cc `@Veykril`

close https://github.com/rust-lang/rust-analyzer/issues/15684
2023-10-31 14:33:00 +00:00
Young-Flash
929544ef28 use check_assist_by_label to pick assist 2023-10-31 22:13:07 +08:00
Young-Flash
a723acf346 simplify the code 2023-10-31 21:03:26 +08:00
cui fliter
9c99afe3aa Fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-30 10:31:50 +08:00
bors
f493207744 Auto merge of #15809 - Young-Flash:extract_variable_in_place, r=HKalbasi
feat: make extract_variable assist in place

![extract_variable_without_select](https://github.com/rust-lang/rust-analyzer/assets/71162630/96be2de4-42c9-4b24-b3e1-8b3e3a2da1d9)

close https://github.com/rust-lang/rust-analyzer/issues/15796
2023-10-28 06:20:35 +00:00
Young-Flash
7186a28717 chore: add unapplicable test for extract_variable without select 2023-10-28 10:06:09 +08:00
Young-Flash
00cdbe6c96 feat: make extract_variable assist in place 2023-10-27 21:16:34 +08:00
Roberto Bampi
99ec3aa8a3 scip: update crate to version 0.3.1.
While the git repo has been updated constantly, crates.io has only now
been updated after more than a year of activity.
2023-10-26 16:20:06 +02:00
bors
2f6961aaaf Auto merge of #15780 - Young-Flash:auto_import, r=lnicola
fix: import trait if needed for `unqualify_method_call` assist

before:

![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/66fda67d-afcb-453f-91a9-7e85993c3d2a)

after:

![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/72ffbda4-1615-4413-836e-480eb52e9728)

follow up https://github.com/rust-lang/rust-analyzer/pull/13825
2023-10-23 16:56:22 +00:00
Young-Flash
45ee88f9cb fix: remove unwrap 2023-10-23 23:12:07 +08:00
hkalbasi
8b82ea4f51 Store binding mode for each instance independently 2023-10-22 23:35:33 +03:30
Young-Flash
4f5f7e2800 feat: import trait with alias 2023-10-22 21:39:00 +08:00
Laurențiu Nicola
094cecd3bd Fix VS Code detection for Insiders version 2023-10-21 19:08:41 +03:00
bors
954fb1d673 Auto merge of #15727 - DaniPopes:lintgen-unstable-book, r=HKalbasi
feat: generate descriptors for all unstable features

Most unstable features don't have their own chapter in the unstable book, so a rustc helper tool (`src/tools/unstable-book-gen`) generates shims to fill the gaps.
Run this tool to generate the full unstable-book source before parsing it.
2023-10-20 16:42:23 +00:00
bors
bd38871a98 Auto merge of #15736 - rmehri01:15678_module_incorrect_case_diagnostics, r=HKalbasi
fix: add incorrect case diagnostics for module names

Adds diagnostics for checking both inline and file module names are snake case.

Closes #15678
2023-10-20 16:20:40 +00:00
Young-Flash
a7f77d89a9 fix: auto import trait if needed 2023-10-19 17:34:17 +08:00
bors
7f1e6fdfee Auto merge of #15775 - Young-Flash:refactor, r=Veykril
refactor: change generated variable name

change generated variable name in `replace_is_some_with_if_let_some` assist

close https://github.com/rust-lang/rust-analyzer/issues/15765
2023-10-18 06:39:34 +00:00
Young-Flash
1a0fe58d81 refactor: change generated variable name 2023-10-17 17:34:11 +08:00
bors
d6afb4fa23 Auto merge of #15746 - pvalletbo:string-literals-diagnose, r=Veykril
String literals diagnose

Continues the work from #15744 to add diagnosis errors to Str, ByteStr, and CStr literal kinds.

Also replaces `unescape_char` for `unescape_byte` to use the correct method for Byte literals.
2023-10-16 18:23:22 +00:00
Lukas Wirth
40acc5250f Update rustc_abi dependency 2023-10-15 18:57:40 +02:00
bors
65532e417d Auto merge of #15755 - Young-Flash:cursor_selection, r=lnicola
fix: make cursor select at _tmp

Here make cursor select at `_tmp` atuomatically after the assist apply. Refer to [vscode snippet placeholder](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_placeholders).

![cursor_selection](https://github.com/rust-lang/rust-analyzer/assets/71162630/a7866efe-2d54-488b-903e-9df039f34a7e)

following https://github.com/rust-lang/rust-analyzer/pull/15752
2023-10-15 07:41:29 +00:00
Christian Schott
8217ff9c16
make ProjectionStore-impls pub-accessible 2023-10-14 19:20:11 +02:00
bors
16ac6c284c Auto merge of #15756 - harpsword:fix_typo_in_mbe_lib, r=lnicola
fix typo in mbe/lib.rs comment

fix typo in mbe/lib.rs comment
2023-10-14 06:23:12 +00:00
harpsword
3f4368a090 fix: fix typo in mbe/lib.rs comment 2023-10-14 14:13:24 +08:00
Young-Flash
bc34e8f1ad feat: make cursor select at _tmp 2023-10-14 11:05:38 +08:00
bors
862693ff95 Auto merge of #15752 - Young-Flash:replace_is_method_with_if_let_method, r=HKalbasi
feat: add replace_is_ok_with_if_let_ok assist

following https://github.com/rust-lang/rust-analyzer/pull/15743
2023-10-13 07:32:55 +00:00
Young-Flash
5bbca22720 update mod order to adapt alphabetically sorted 2023-10-13 00:09:13 +08:00
Young-Flash
506b1e515b feat: add replace_is_ok_with_if_let_ok assist 2023-10-12 23:26:42 +08:00
bors
84e1d27343 Auto merge of #15743 - Young-Flash:replace_is_some_with_if_let_some, r=HKalbasi
add replace_is_some_with_if_let_some assist

This is a basic impl, if it is ok, `if my_result.is_ok()`-> `if let Ok(_x) = my_result ​`will be add next.

close https://github.com/rust-lang/rust-analyzer/issues/12977
2023-10-12 08:20:08 +00:00
Young-Flash
3605bb38ff fix CI: generate doctest 2023-10-12 11:50:44 +08:00
Pol Valletbó
6845c80a2f fix: format 2023-10-11 15:52:22 +02:00
Pol Valletbó
4b281ffdf2 chore: format imports 2023-10-11 15:52:05 +02:00
Pol Valletbó
b769f34f63 chore: move common code to function 2023-10-11 15:45:45 +02:00
Pol Valletbó
e1aeb7fa79 fix: handle errors for string byte string and c_string 2023-10-11 15:25:52 +02:00
Pol Valletbó
677e6f3439 fix: use unescape_byte function for Byte literals 2023-10-11 13:09:15 +02:00
Pol Valletbó
f58a8250dc fix: cargo fmt 2023-10-11 12:36:53 +02:00
Pol Valletbó
1fe6ac87e9 add diagnosis messages for chars and byte literal errors 2023-10-11 12:19:00 +02:00
Young-Flash
a7fada4650 add replace_is_some_with_if_let_some assist 2023-10-11 17:44:27 +08:00
Ryan Mehri
36eac9abee fix: add incorrect case diagnostics for module names 2023-10-09 13:36:39 -07:00
bors
aaa1e8e1b8 Auto merge of #15618 - shogo-nakano-desu:internal/port-anymap, r=Veykril
internal: port anymap

## Description
- The anymap crate has been ported. During this process, unnecessary features for rust-analyzer have been removed.
- From the tests that were checking the existing licenses, the anymap license (`BlueOak-1.0.0 OR MIT OR Apache-2.0`) has been removed.

## Requests
- While porting the code this time, I have tried to respect the original author's intentions and have kept the comments/codes as much as possible. Please don't hesitate to tell me if you think the comments/codes also need to be appropriately modified.
- If there are any necessary changes regarding the licensing or anything else, please let me know so I can fix them.

## Issue
https://github.com/rust-lang/rust-analyzer/issues/15500
2023-10-09 08:40:54 +00:00
bors
ab62c0186f Auto merge of #15696 - rmehri01:14293_tuple_return_type_to_struct, r=Veykril
feat: implement tuple return type to tuple struct assist

This PR implements the `convert_tuple_return_type_to_struct` assist, for converting the return type of a function or method from a tuple to a tuple struct. Additionally, it moves the `to_camel_case` and `char_has_case` functions from `case_conv` to `stdx` so that they can be used similar to `to_lower_snake_case`.

[tuple_return_type_to_tuple_struct.webm](https://github.com/rust-lang/rust-analyzer/assets/52933714/2803ff58-fde3-4144-9495-7c7c7e139075)

Currently, the assist puts the struct definition above the function, or above the nearest `impl` or `trait` if applicable and only rewrites literal tuples that are returned in the body of the function. Additionally, it only attempts to rewrite simple tuple pattern usages with the corresponding tuple struct pattern but does so across files and modules.

I think that this is sufficient for the majority of use cases but I could be wrong. One thing I'm still not sure how to approach is handling `Self` and generics/lifetimes in the tuple type to be extracted. I was thinking of either manually figuring out what lifetimes and generics are in scope and using them (sort of similar to the `generate_function` assist) or maybe using `ctx.sema.resolve_type` and `generic_params` on `hir::Type` but this seems to not deal with lifetimes.

Closes #14293
2023-10-09 08:14:42 +00:00