Commit Graph

26960 Commits

Author SHA1 Message Date
Young-Flash
a7f77d89a9 fix: auto import trait if needed 2023-10-19 17:34:17 +08:00
bors
4586a6b26c Auto merge of #15779 - Veykril:open-docs, r=Veykril
Add command for only opening external docs and attempt to fix vscode-remote issue

opening URI in a remote env causes vscode to ask the OS to handle `vscode-remote` URIs as there is no handler registered for such a scheme. This attempts to instruct vscode to handle those.

This is untested, as I can't figure out how to open a debug session on WSL rn.
2023-10-18 12:13:01 +00:00
Lukas Wirth
4296fe52ba Add command for only opening external docs and attempt to fix vscode-remote issue 2023-10-18 14:06:07 +02: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
bors
2910dbf12d Auto merge of #15770 - lnicola:metrics-url, r=lnicola
internal: Fix metrics repo url
2023-10-16 13:35:33 +00:00
Laurențiu Nicola
490cdfecb5 Fix metrics repo url 2023-10-16 16:34:03 +03:00
bors
03f676ed1f Auto merge of #15769 - lnicola:metrics-ssh, r=lnicola
internal: Create `~/.ssh` before writing deploy key
2023-10-16 12:15:19 +00:00
Laurențiu Nicola
222be48858 Create .ssh before writing deploy key 2023-10-16 15:13:48 +03:00
bors
983094a32c Auto merge of #15764 - Wilfred:emacs_docs, r=lnicola
Expand Emacs documentation

Emacs 29 is now released, and include an example of enabling clippy.
2023-10-16 09:30:56 +00:00
Wilfred Hughes
03bec1112a Expand Emacs documentation
Emacs 29 is now released, and include an example of enabling clippy.
2023-10-15 16:34:23 -07:00
bors
6572ec8d94 Auto merge of #15691 - Veykril:rustc_abi, r=Veykril
Update rustc_abi dependency

cc https://github.com/rust-lang/rust/pull/116269
2023-10-15 17:01:38 +00:00
Lukas Wirth
40acc5250f Update rustc_abi dependency 2023-10-15 18:57:40 +02:00
bors
a8581aa0ff Auto merge of #15762 - Veykril:metrics-deploy, r=Veykril
fix: Fix metrics workflow to use deploy key

I think this should be correct
2023-10-15 16:02:36 +00:00
Lukas Wirth
d33fd15ecf Fix metrics workflow to use deploy key 2023-10-15 17:58:50 +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
bors
dbe5392010 Auto merge of #15760 - ChristianSchott:master, r=HKalbasi
make mir::ProjectionStore-impls pub-accessible

When using RA as a crate the `mir::Place` `projection` is accessible, however there is no way to translate the `ProjectionId` to a `&[PlaceElem]`, as the `ProjectionId::lookup` is private.

Personally, I would only need the `ProjectionId::lookup`-fn to be `pub`, but I don't see any reason why the others should be kept private.. am I missing something `@HKalbasi` ?

Relates to: https://github.com/rust-lang/rust-analyzer/pull/15575
2023-10-14 18:07:56 +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
bors
7eec17e627 Auto merge of #15745 - osiewicz:add-zed-to-ide-list, r=lnicola
docs: Add Zed to IDE list.
2023-10-11 13:50:24 +00:00
Pol Valletbó
b769f34f63 chore: move common code to function 2023-10-11 15:45:45 +02:00
Piotr Osiewicz
2e713a7a2f docs: Add Zed to IDE list. 2023-10-11 15:45:16 +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
bors
c3873616d3 Auto merge of #15744 - pvalletbo:15395/character-byte-literals-diagnose, r=Veykril
fix: add diagnostics messages for chars and byte literal errors

This PR adds error messages for different invalid byte or character literals.
Fixes #15395
2023-10-11 10:49:30 +00: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
bors
8a2331450a Auto merge of #15728 - EliasHolzmann:feature/local_documentation_vscode, r=Veykril
feat: vscode: Support opening local documentation if available

This PR implements the VS code support for opening local documentation (server side support was already implemented in #14662).

[local_docs.webm](https://github.com/rust-lang/rust-analyzer/assets/9659253/715b84dd-4f14-4ba0-a904-749b847eb3d5)

Displaying local instead of web docs can have many benefits:
- the web version may have different features enabled than locally selected
- the standard library may be a different version than is available online
- the user may not be online and therefore cannot access the web documentation
- the documentation may not be available online at all, for example because it is for a new feature in a library the user is currently developing

If the documentation is not available locally, the extension still falls back to the web version.

Closes #12867.

-----

If my implementation isn't really idiomatic TypeScript: Sorry, I'm not much of a TypeScript developer. I am open to feedback, however.
2023-10-10 06:33:10 +00:00
Ryan Mehri
36eac9abee fix: add incorrect case diagnostics for module names 2023-10-09 13:36:39 -07:00
Elias Holzmann
e8372e0484 vscode: Support opening local documentation if available
Displaying local instead of web docs can have many benefits:
- the web version may have different features enabled than locally selected
- the standard library may be a different version than is available online
- the user may not be online and therefore cannot access the web documentation
- the documentation may not be available online at all, for example because it
  is for a new feature in a library the user is currently developing

If the documentation is not available locally, the extension still falls back to
the web version.
2023-10-09 20:11:53 +02: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
bors
dca63d1b21 Auto merge of #15713 - Veykril:flyimport-completions-short, r=Veykril
Do flyimport completions by prefix search for short paths

Fixes https://github.com/rust-lang/rust-analyzer/issues/15711
2023-10-09 07:56:02 +00:00
DaniPopes
0c4be03456
feat: generate descriptors for all unstable features 2023-10-09 09:36:47 +02:00
bors
d646ae80c5 Auto merge of #15681 - Tyrubias:custom_target_dir, r=Veykril
Add config option to use `rust-analyzer` specific target dir

Adds a Rust Analyzer configuration option to set a custom target directory for builds. This is a workaround for Rust Analyzer blocking debug builds while running `cargo check`. This change should close #6007.

This is my first time contributing to this project, so any feedback regarding best practices that I'm not aware of are greatly appreciated! Thanks to all the maintainers for their hard work on this project and reviewing contributions.
2023-10-09 07:27:03 +00:00
Victor Song
a39d2076db Addressed PR style comments 2023-10-09 02:15:05 -05:00
Victor Song
9771e1e18f Don't pass any target directory options to custom flycheck 2023-10-09 02:15:05 -05:00
Victor Song
2290cc3cf3 Pass target directory as flag instead of env variable 2023-10-09 02:15:05 -05:00
Victor Song
3682c3791b Set CARGO_TARGET_DIR when using Flycheck custom command 2023-10-09 02:15:05 -05:00