Commit Graph

26638 Commits

Author SHA1 Message Date
bors
4fc208e693 Auto merge of #15882 - Veykril:fix-config-keys, r=Veykril
minor: Fix import preference config keys
2023-11-12 16:50:10 +00:00
Lukas Wirth
d6b908ec41 Fix import preference config keys 2023-11-12 17:48:40 +01:00
bors
92d9ca7d64 Auto merge of #15876 - DropDemBits:lsp-ext-multiple-snippet-textedit, r=Veykril
minor: Allow multiple snippet edits in a `TextDocumentEdit`

Explicitly[^1] allow a single `TextDocumentEdit` to have multiple `SnippetTextEdit`s. This allows things like renaming extracted variables and functions without having to go through a separate rename step. For an example of what this looks like, see the video in [this comment](https://github.com/microsoft/vscode/issues/145374#issuecomment-1177341711).

The behavior described here lines up with [what VSCode does](bdc113ffe1/src/vscode-dts/vscode.d.ts (L3728-L3731)), and presumably what the eventual LSP behavior will be.

[^1]: This was technically the case before #15269, a single `TextDocumentEdit` always had multiple edits which were `InsertTextFormat.Snippet` as all of the edits were marked as being snippets, even if there weren't any tab stops or placeholders.
2023-11-12 15:20:42 +00:00
bors
8bfe0aaba9 Auto merge of #15880 - lnicola:vfs-toml, r=Veykril
internal: Include toml files in the vfs

Closes #15753
2023-11-12 15:04:02 +00:00
Laurențiu Nicola
bad3d9e766 Include toml files in the vfs 2023-11-12 16:45:47 +02:00
bors
1152f593b3 Auto merge of #15870 - lnicola:expand-macro, r=lnicola
minor: Make "Expand macro" command title more explicit

Closes [#15856](https://github.com/rust-lang/rust-analyzer/issues/15856).

I opted for "caret", since it's the better term (cursor is the mouse), but I'm not sure how popular it is these days.
2023-11-12 13:48:43 +00:00
Laurențiu Nicola
cace36cade Make Expand macro command title more explicit 2023-11-12 11:43:46 +02:00
Young-Flash
23fde40fed fix PathSegment grammar 2023-11-12 11:20:14 +08:00
DropDemBits
1e4686865e
Allow multiple snippet edits in a TextDocumentEdit 2023-11-11 22:12:49 -05:00
DropDemBits
4aaa592a9a
Migrate destructure_tuple_binding to mutable ast
Due to the way the current tree mutation api works, we need to collect
changes before we can apply them to the real syntax tree, and also can only
switch to a file once.

`destructure_tuple_binding_in_sub_pattern` also gets migrated even
though can't be used.
2023-11-11 21:07:19 -05:00
DropDemBits
f3dcc67dfa
Migrate add_type_ascription 2023-11-11 21:05:27 -05:00
DropDemBits
5fc8cc52e2
Add LetStmt::set_ty
Way for setting and removing the type ascription of a let stmt
2023-11-11 21:05:27 -05:00
DropDemBits
92422f7488
Use syntax's version of SyntaxElement 2023-11-11 21:05:27 -05:00
DropDemBits
cc4e06f04b
Migrate add_turbo_fish to mutable ast
`add_type_ascription` is still left as-is since it's a different assist
2023-11-11 21:05:26 -05:00
DropDemBits
02c7b8b9ba
Add MethodCallExpr::get_or_create_generic_arg_list
Mirrors `PathSegment's` version, except that it always generates a
turbofish
2023-11-11 21:05:26 -05:00
nokazn
b6f0994ee6
docs: fix VS Code setting samples 2023-11-12 10:29:56 +09:00
bors
5fcf5289e7 Auto merge of #15871 - Veykril:import-map, r=Veykril
Add config for preferring / ignoring prelude modules in find_path
2023-11-11 15:05:08 +00:00
Lukas Wirth
74e5444f15 Fix some FIXMEs 2023-11-11 15:49:57 +01:00
Lukas Wirth
ba61766217 Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
Lukas Wirth
801a887954 Record all import paths per item in ImportMap 2023-11-11 14:48:44 +01:00
Lukas Wirth
2339ba4440 Prepare ImportMap for supportin multiple import paths per item 2023-11-11 14:04:24 +01:00
Pascal Kuthe
0647b645cd
ensure renames happen after edit 2023-11-10 17:39:32 +01:00
bors
11a87c9179 Auto merge of #15866 - lnicola:include-check, r=Veykril
Improve check for include macro

https://github.com/rust-lang/rust-analyzer/pull/15819#pullrequestreview-1724883108
2023-11-10 15:12:29 +00:00
Laurențiu Nicola
9826717550 Improve check for include macro 2023-11-10 16:53:08 +02:00
bors
7cca4e5816 Auto merge of #15854 - alibektas:15782/relax_hidden_attr, r=lnicola
fix: Ignore doc(hidden) attr if no body is present

fixes #15782
2023-11-10 13:30:52 +00:00
bors
5afaf680b8 Auto merge of #15864 - Young-Flash:find_self, r=lnicola
fix: find `Self` reference

took a lot of time to debug to find the problem, here should compare the actual `Adt` type

close https://github.com/rust-lang/rust-analyzer/issues/12693
2023-11-10 13:13:14 +00:00
Young-Flash
e0276dc5dd fix: find Self reference 2023-11-10 19:54:43 +08:00
bors
76633199f4 Auto merge of #15860 - HKalbasi:fix-capture-raw-pointer, r=HKalbasi
Truncate closure capture place for raw pointer

fix https://github.com/rust-lang/rust-analyzer/issues/15670#issuecomment-1804070623
2023-11-09 17:53:52 +00:00
bors
ebb9ed90d1 Auto merge of #15853 - Kangaxx-0:gaxx/update-parser-event-comment, r=lnicola
Try to update parser/event doc

`TokenSource` and `TreeSink` has been refactored as part of #10765, they no longer exist in code repo. This pr tries to remove them from event module level comment to prevent confusion.
2023-11-09 17:39:58 +00:00
hkalbasi
3bcdb7d886 Truncate closure capture place for raw pointer 2023-11-09 20:59:17 +03:30
Young-Flash
be62e0bf08 fix: remove parenthesis should ensure space 2023-11-09 18:33:49 +08:00
Ali Bektas
b0101da116 Ignore doc(hidden) attr if no body is present 2023-11-09 02:12:53 +01:00
Gaxx
fa7a91844a Try to update parser doc 2023-11-08 16:29:21 -08:00
bors
7059ae2fc2 Auto merge of #15847 - wasd96040501:feat/preview_adt, r=lnicola
feat: preview adt field when hover

Closes #13977
![20231108194345_rec_](https://github.com/rust-lang/rust-analyzer/assets/14040068/95894c4b-de6e-4ca4-98b3-6ab4559d0950)
2023-11-08 13:48:19 +00:00
YangzeLuo
41bcd542e2 feat: preview adt field when hover 2023-11-08 21:45:32 +08:00
Laurențiu Nicola
d1d111d09e Merge commit '3b7c7f97e4a7bb253a8d398ee4f8346f6cf2817b' into sync-from-ra 2023-11-08 08:15:03 +02:00
bors
3b7c7f97e4 Auto merge of #15849 - HKalbasi:fix-sync, r=HKalbasi
Update rustc dependencies

Except `rustc_parse_format` that was broken by upstream.
2023-11-07 22:13:41 +00:00
hkalbasi
1086b294c2 update rustc dependencies 2023-11-08 01:16:47 +03:30
jprochazk
c566136854 add configuration option 2023-11-07 16:33:45 +01:00
bors
2a48432819 Auto merge of #15843 - roife:master, r=lnicola
minor: correct a typo in a comment in base-db/lib.rs
2023-11-07 07:11:28 +00:00
roife
13249b7dd9 fix: correct a typo in a comment in base-db/lib.rs 2023-11-07 14:51:34 +08:00
bors
c1c9e10f72 Auto merge of #15832 - Young-Flash:generate_mut_trait, r=lnicola
feat: add generate_mut_trait_impl assist

![generate_mut_trait_impl](https://github.com/rust-lang/rust-analyzer/assets/71162630/362a5a93-e109-4ffc-996e-9b6e4f54fcfa)

Generate proper `index_mut` method body refer to `index` method body may impossible due to the unpredicable case (#15581).

Here just leave the `index_mut` method body be same as `index` method body, user can modify it manually to meet their need.
2023-11-05 14:00:24 +00: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
bors
69432287cb Auto merge of #15834 - lnicola:derive-docs, r=lnicola
fix: Fix docs path for derive macros

Fixes #15831.

Not sure about `attr`, I don't think those are documented anyway. And many macros don't work because we pick the wrong path.
2023-11-04 11:44:56 +00:00
Laurențiu Nicola
19bf0da9d7 Fix docs path for derive macros 2023-11-04 13:33:19 +02:00
Nicholas Nethercote
6eaf3f8bb2 Remove support for compiler plugins.
They've been deprecated for four years.

This commit includes the following changes.
- It eliminates the `rustc_plugin_impl` crate.
- It changes the language used for lints in
  `compiler/rustc_driver_impl/src/lib.rs` and
  `compiler/rustc_lint/src/context.rs`. External lints are now called
  "loaded" lints, rather than "plugins" to avoid confusion with the old
  plugins. This only has a tiny effect on the output of `-W help`.
- E0457 and E0498 are no longer used.
- E0463 is narrowed, now only relating to unfound crates, not plugins.
- The `plugin` feature was moved from "active" to "removed".
- It removes the entire plugins chapter from the unstable book.
- It removes quite a few tests, mostly all of those in
  `tests/ui-fulldeps/plugin/`.

Closes #29597.
2023-11-04 08:50:46 +11:00
bors
0fec61aabf Auto merge of #15827 - notpeter:vscode_rust_formatter, r=lnicola
VSCode metadata. category:formatters

If you invoke cmd+p `Format Document` without rust-analyzer installed in the workspace, VSCode suggests you "install a formatter" which triggers a search for `category:formatters rust`. Sadly rust-analyzer extension is not suggested.

Tweak VSCode Extension Metadata so rust-analyzer shows up in 'category:formatters rust' search.

You can see the valid values for categories in the [extension manifest: field reference](https://code.visualstudio.com/api/references/extension-manifest#fields) docs.

<img width="270" alt="search2" src="https://github.com/rust-lang/rust-analyzer/assets/145113/5bd86497-2450-4be4-a073-e134d0616226">
<img width="432" alt="search_1" src="https://github.com/rust-lang/rust-analyzer/assets/145113/1ad1b375-58a1-4b37-b485-78e2a26b8342">
2023-11-03 06:52:57 +00:00
Peter Tripp
fccdde63c9
Maybe not a linter. 2023-11-02 18:21:31 -04:00
Peter Tripp
1b7bb9a7bd
VSCode search: 'category:formatters rust' metadata. 2023-11-02 15:54:32 -04:00