Commit graph

18748 commits

Author SHA1 Message Date
Johann Hemmann
f8ff4fb75b Conditionally include use_name_in_title and cfg 2024-01-04 18:47:08 +01:00
Johann Hemmann
61b552124a Move check_expect and check_expect_clear_loc to inlayhints::chaining 2024-01-04 17:32:16 +01:00
Johann Hemmann
594e0a5de6 Only compare range and label 2024-01-04 17:29:20 +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
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
Johann Hemmann
dea149d733 Switch to BTreeMap for stable ordering 2024-01-04 14:01:03 +01:00
Johann Hemmann
05a3c2ff20 Make filtering a function 2024-01-04 14:01:03 +01:00
Johann Hemmann
d1f4171bb6 Refactor to iterators 2024-01-04 14:01:03 +01:00
Johann Hemmann
084acc287a Extract relevant information into hashmaps 2024-01-04 14:01:02 +01:00
Laurențiu Nicola
688911757e Add description to span crate manifest 2024-01-04 13:27:32 +02:00
bors
95e047e4ac Auto merge of #16248 - Veykril:proc-macro-test, r=lnicola
internal: Add proc-macro-test crate back to the main workspace

Should fix https://github.com/rust-lang/rust-analyzer/issues/16194
2024-01-04 11:00:33 +00:00
Laurențiu Nicola
a66777cc71 Merge branch 'master' into sync-from-rust 2024-01-04 12:44:34 +02:00
Laurențiu Nicola
adf052c2ba Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-rust 2024-01-04 12:44:20 +02:00
Lukas Wirth
751d9d11e0 Add proc-macro-test crate back to the main workspace 2024-01-04 11:09:45 +01:00
bors
9279c6566b Auto merge of #16237 - Veykril:expand-arc-alloc, r=Veykril
internal: Remove unnecessary `Arc` allocations in `macro_expand`
2024-01-03 14:40:10 +00:00
bors
c3c07c66d3 Auto merge of #15933 - 71:inherent-items-in-docs, r=Veykril
feat: resolve inherent and implemented associated items in docs

This partially fixes #9694.

Supported:
- Trait methods and constants.
  * Due to resolution differences pointed out during the review of the PR, trait associated types are _not_ supported.
- Inherent methods, constants and associated types.
  * Inherent associated types are a [nightly feature](https://github.com/rust-lang/rust/issues/8995), and are supported with no additional work in this PR.

Screenshot of VS Code running with the change:

<img width="513" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/7189784/c37ed8b7-b572-4684-8e81-2a817b0027c4">

You can see that the items are resolved (excl. trait associated types) since they are semantically highlighted in the doc comment.
2024-01-03 14:28:38 +00:00
Lukas Wirth
3fc043ce9b internal: Remove unnecessary Arc allocations in macro_expand 2024-01-03 15:21:18 +01:00
bors
3fe6ff74cf Auto merge of #16085 - Austaras:master, r=Veykril
fix: try obligation of `IndexMut` when infer

Closes #15842.

This issue arises because `K` is ambiguous if only inferred from `Index` trait, but is unique if inferred from `IndexMut`, but r-a doesn't use this info.
2024-01-03 14:18:13 +00:00
Grégoire Geis
fe6f931ac2 hir: resolve associated items in docs (excl. type aliases) 2024-01-03 23:04:24 +09:00
bors
078183231b Auto merge of #16179 - nicolas-guichard:scip/new_fields, r=Veykril
SCIP: populate new SymbolInformation fields

Fixes #15919
2024-01-03 12:56:47 +00:00
Nicolas Guichard
73d9c77f2a scip: Populate SymbolInformation::kind
SymbolInformation::kind is finer-grained than the SCIP symbol suffix.
This also fixes a bug where all type aliases where treated like type
parameters.

```
trait SomeTrait {
  type AssociatedType; // ← this is SomeTrait#[AssociatedType]
}

type MyTypeAlias = u8; // ← this used to be [MyTypeAlias]
                       //   and now is MyTypeAlias#
```
2024-01-03 13:05:36 +01:00
Lukas Wirth
cf22f02dc5 fix: Fix focus range being discarded in attributes/derives when upmapping 2024-01-03 12:15:28 +01:00
Nicolas Guichard
566bb77f91 scip: Populate SymbolInformation::signature_documentation 2024-01-03 10:56:12 +01:00
Nicolas Guichard
b24914970f Refactor label & docs from ide::hover::render to ide-db::defs::Definition
To build the SymbolInformation::signature_documentation we need access
to the “label” when building the TokenStaticData, preferably without
any markdown markup.
Therefore this refactors ide::hover::render::definition and its helper
functions to give easier access to the label alone.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
495a55689b scip: Populate SymbolInformation::enclosing_symbol
For local variables, this gets the moniker from the enclosing
definition and stores it into the TokenStaticData.
Then it builds the scip symbol for that moniker when building the
SymbolInformation.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
62663e6d4b scip: Refactor token_to_symbol to moniker_to_symbol
This is meant to implement SymbolInformation::enclosing_symbol, so we
can build the enclosing symbol from the enclosing moniker without
having the full enclosing token's TokenStaticData.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
375f1cca4f scip: Populate SymbolInformation::display_name 2024-01-03 10:54:57 +01:00
Laurențiu Nicola
d3d7c4b722 Allow unexpected_cfgs in proc-macro-test imp 2024-01-03 11:36:05 +02:00
Laurențiu Nicola
932d85b529 Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-ra2 2024-01-03 11:35:07 +02:00
bors
426d2842c1 Auto merge of #16222 - rosefromthedead:unresolved-assoc-item, r=Veykril
add unresolved-assoc-item assist

I tried to copy from private-assoc-item for this
2024-01-02 15:06:13 +00: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
bors
1a0b772a43 Auto merge of #16153 - Veykril:err-msg, r=Veykril
fix: Notify user that linkedProjects is set when failing to discover projects

Fixes https://github.com/rust-lang/rust-analyzer/issues/15171
2024-01-02 14:42:03 +00:00
Lukas Wirth
8136e739f5 fix: Notify user that linkedProjects is set when failing to discover projects 2024-01-02 15:24:21 +01:00
bors
df94a87ea8 Auto merge of #16139 - jimmyhmiller:master, r=Veykril
Make functions in impl have a container name

fixes #16015
2024-01-02 14:08:37 +00:00
bors
7040cef07d Auto merge of #16068 - roife:fix-introduce-named-generic-name-conflicts, r=Veykril
fix: pick up new names when the name conflicts in 'introduce_named_generic'

Improve generation of names for generic parameters in `introduce_named_generics`.

fix #15731.

### Changes

- Modified `for_generic_parameter` function in `suggest_name.rs` to handle conflicts with existing generic parameters and generate unique names accordingly.
- Update `introduce_named_generic` function and pass existing params to `for_generic_parameter`, enabling the detection and handling of name collisions.
2024-01-02 13:58:06 +00:00
bors
f7a29e4e88 Auto merge of #16100 - Young-Flash:assoc_func_quickfix, r=Veykril
feat: add assoc func quickfix for `unresolved_method` diagnostic

![demo](https://github.com/rust-lang/rust-analyzer/assets/71162630/1ea1d8b8-3436-4251-a512-e0f9de01a13c)

close https://github.com/rust-lang/rust-analyzer/issues/13247

EDIT: I think add a demo gif would be helpful to `@lnicola` when he make a release change log :)
2024-01-02 13:46:35 +00:00
roife
919ecc6c32 Use HashSet to enhance performance in for_unique_generic_name in suggest_name 2024-01-02 21:33:06 +08:00
roife
bc1a5774fd fix: handle with type bounds in existing_params 2024-01-02 21:30:57 +08:00
roife
186553dab8 refactor: extracted the fn handling conflicts in generics and add docs
* Extracted the function `for_unique_generic_name` that handling generics with identical names for reusability.
* Renamed `for_generic_params` to `for_impl_trait_as_generic` for clarity
* Added documentations for `for_impl_trait_as_generic` and `for_unique_generic_name`
2024-01-02 21:30:57 +08:00
roife
e8dc8ccc59 fix: pick up new names when the name exists in 'introduce_named_generic' 2024-01-02 21:30:55 +08:00
Luiz Carvalho
9a36bc393d
fix(completion): render fn type 2024-01-02 10:30:16 -03:00
Young-Flash
91bd59682a fix: make editing range accommodate for macros 2024-01-02 21:30:13 +08: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