429 Commits

Author SHA1 Message Date
Shoyu Vanilla
7de0b2e75a feat: Implement default-field-values 2025-01-27 19:38:35 +09:00
Lukas Wirth
3bb0ff3480 Add GenericDefId::StaticId 2025-01-26 11:07:54 +01:00
Lukas Wirth
5df0b592c1
Merge pull request #19028 from Veykril/push-vuytpkvqzwzs
fix: Fix flyimport not filtering via stability of import path
2025-01-25 11:34:36 +00:00
Lukas Wirth
b31f53e0d6 Fix flyimport not filtering via stability of import path 2025-01-25 12:18:54 +01:00
Lukas Wirth
fbf3d08a30
Merge pull request #19026 from Veykril/push-wrxrutptywzx
Only collect implicit visibile use symbols if they have renames
2025-01-25 10:27:26 +00:00
Lukas Wirth
7acf8dcf7b Only collect implicit visibile use symbols if they have renames
Otherwise this will pollute the index too much with unnecessary symbols
2025-01-25 11:12:06 +01:00
Wilfred Hughes
4c34352517 minor: Suggest better names when a type is a sequence
Previously, we'd suggest a type of `vec` for a value of type `Vec<T>`,
which is rarely what the user wants. We also had no suggestions for
values of type `&[T]`.

Instead, try to pluralise the inner type name, and fall back to
`items`.
2025-01-24 11:30:19 -08:00
Lukas Wirth
93de80d833
Merge pull request #19016 from Veykril/push-moqnsytyrupu
fix: Fix `ItemScope` not recording glob imports
2025-01-24 13:25:39 +00:00
Lukas Wirth
3b88a2f134 Fix ItemScope not recording glob imports
This caused us other code to incorrectly assume in dealing with a declaration when in fact it was dealing with a glob imported definition
2025-01-24 14:11:45 +01:00
Lukas Wirth
2c040c03cf
Merge pull request #18986 from Veykril/push-zlwvwlowpzqm
Goto `Display::fmt` when invoked on `to_string`
2025-01-21 09:25:05 +00:00
Lukas Wirth
76585539f5 Cleanup Name string rendering 2025-01-21 10:05:32 +01:00
Lukas Wirth
a3eee10638 Goto Display::fmt when invoked on to_string 2025-01-20 17:00:28 +01:00
Lukas Wirth
03ea40369f Move dual blanket impl logic from source analyzer to goto_def 2025-01-20 16:24:42 +01:00
Lukas Wirth
a06606c802 Fix import search not discarding rawness 2025-01-20 14:29:11 +01:00
Lukas Wirth
20ff27e2ba Less allocs 2025-01-20 14:29:11 +01:00
Lukas Wirth
0480ebef75 Preserve impl assoc names in ImplData 2025-01-20 14:29:11 +01:00
Lukas Wirth
76c1a376c3 Vec -> Box<[_]> 2025-01-20 14:29:11 +01:00
Lukas Wirth
51cc1a4614 Properly record meaningful imports as re-exports in symbol index 2025-01-20 14:29:11 +01:00
Lukas Wirth
132a2a03c4
Merge pull request #18951 from Veykril/push-zpvunsvlpuxt
Add missing `#[rust_analyzer::rust_fixture]` annotations
2025-01-16 10:21:22 +00:00
Lukas Wirth
3361b5701a Generalize some type walking in hover type actions 2025-01-16 11:06:11 +01:00
Lukas Wirth
3e2848dc59 Add missing #[rust_analyzer::rust_fixture] annotations 2025-01-16 10:51:57 +01:00
Lukas Wirth
2a89e4a051 Early exit in search properly 2025-01-15 09:47:45 +01:00
Lukas Wirth
bf669dab84 Re-implement rust string highlighting via tool attribute 2025-01-10 13:49:35 +01:00
Lukas Wirth
897f7e579e
Merge pull request #18904 from Veykril/push-yztnorquuyzw
Improve hover module path rendering
2025-01-10 11:53:38 +00:00
Lukas Wirth
d4fa92e80a Implement implicit sized bound inlay hints 2025-01-10 12:38:21 +01:00
Lukas Wirth
3bae1f0a1b Improve hover module path rendering 2025-01-10 12:36:55 +01:00
Lukas Wirth
6f04f373d7
Merge pull request #18902 from Veykril/push-znlsxykqrkoo
internal: Add Definition::Crate
2025-01-10 10:01:43 +00:00
Lukas Wirth
e6270bd378 internal: Add Definition::Crate
This is its own thing so it should be handled specifically where possible
2025-01-10 10:45:44 +01:00
Chayim Refael Friedman
87f7a5849c Remove two hir reexports 2025-01-10 03:19:28 +02:00
Lukas Wirth
4b6007115a minor: New clippy lints 2025-01-06 17:57:17 +01:00
Lukas Wirth
add0963033
Merge pull request #18758 from mgsloan/scip-unique-symbols
Improve SCIP symbols
2024-12-31 09:25:30 +00:00
Michael Sloan
5f7425ca20 Move container_to_definition function into enclosing_definition 2024-12-30 13:52:09 -07:00
roife
f8c04166dc fix: avoid generating colliding names in extract_variable 2024-12-30 15:30:05 +08:00
Michael Sloan
17c90f71bf Improve SCIP symbols
In particular, the symbol generation before this change creates a lot
of symbols with the same name for different definitions. This change
makes progress on symbol uniqueness, but does not fix a couple cases
where it was unclear to me how to fix (see TODOs in `scip.rs`)

Behavior changes:

* `scip` command now reports symbol information omitted due to symbol
collisions. Iterating with this on a large codebase (Zed!) resulted in
the other improvements in this change.

* Generally fixes providing the path to nested definitions in
symbols. Instead of having special cases for a couple limited cases of
nesting, implements `Definition::enclosing_definition` and uses this
to walk definitions.

* Parameter variables are now treated like locals.

    - This fixes a bug where closure captures also received symbols
    scoped to the containing function.  To bring back parameter
    symbols I would want a way to filter these out, since they can
    cause symbol collisions.

    - Having symbols for them seems to be intentional in
    27e2eea54fbd1edeefa2b47ddd4f552a04b86582, but no particular use is
    specified there. For the typical indexing purposes of SCIP I don't see
    why parameter symbols are useful or sensible, as function parameters
    are not referencable by anything but position. I can imagine they
    might be useful in representing diagnostics or something.

* Inherent impls are now represented as `impl#[SelfType]` - a type
named `impl` which takes a single type parameter.

* Trait impls are now represented as `impl#[SelfType][TraitType]` - a
type named `impl` which takes two type parameters.

* Associated types in traits and impls are now treated like types
instead of type parameters, and so are now suffixed with `#` instead
of wrapped with `[]`.  Treating them as type parameters seems to have
been intentional in 73d9c77f2aeed394cf131dce55807be2d3f54064 but it
doesn't make sense to me, so changing it.

* Static variables are now treated as terms instead of `Meta`, and so
receive `.` suffix instead of `:`.

* Attributes are now treated as `Meta` instead of `Macro`, and so
receive `:` suffix instead of `!`.

* `enclosing_symbol` is now provided for labels and generic params,
which are local symbols.

* Fixes a bug where presence of `'` causes a descriptor name to get
double wrapped in backticks, since both `fn new_descriptor` and
`scip::symbol::format_symbol` have logic for wrapping in
backticks. Solution is to simply delete the redundant logic.

* Deletes a couple tests in moniker.rs because the cases are
adequeately covered in scip.rs and the format for identifiers used in
moniker.rs is clunky with the new representation for trait impls
2024-12-25 21:51:58 -07:00
Lukas Wirth
e30ce42671
Merge pull request #18707 from ChayimFriedman2/subst
feat: Show substitution where hovering over generic things
2024-12-24 14:16:16 +00:00
Chayim Refael Friedman
b5486ffc42 Show substitution where hovering over generic things
There are few things to note in the implementation:

First, this is a best-effort implementation. Mainly, type aliases may not be shown (due to their eager nature it's harder) and partial pathes (aka. hovering over `Struct` in `Struct::method`) are not supported at all.

Second, we only need to show substitutions in expression and pattern position, because in type position all generic arguments always have to be written explicitly.
2024-12-20 11:30:19 +02:00
Lukas Wirth
ada5f2059c fix: Fix path qualified auto-importing completions not working with re-exports
Prior to this commit we used to generate import paths, then zipped them with the existing qualifier to check if they agree on the path to import.
This is brittle when re-exports come into play causing items to have multiple applicable paths that refer to them.
This commit instead rewrites this logic by generating the import path for the qualifier, verifying that the rest of the qualifier resolves and then doing a final lookup on that resolution result for the final segment instead.
2024-12-16 13:20:55 +01:00
roife
cb1533f7e9 feat: improve name generation in destructure_tuple_binding 2024-12-13 23:34:03 +08:00
Laurențiu Nicola
dc978a976f Bump typos 2024-12-13 11:45:44 +02:00
Chayim Refael Friedman
0b7a6f38d7 Properly handle different defaults for severity of lints
Previously all lints were assumed to be `#[warn]`, and we had a hand-coded list of `#[allow]` exceptions. Now the severity is autogenerated from rustdoc output.

Also support lints that change status between editions, and the `warnings` lint group.
2024-12-11 20:48:41 +02:00
Laurențiu Nicola
30262281eb Merge from rust-lang/rust 2024-12-11 11:49:08 +02:00
roife
9c03cbb499 minor: enhance name suggestion for Arc<T> and Rc<T> 2024-12-10 02:47:52 +08:00
Lukas Wirth
d6b62265b5 fix: Resolve generic parameters within use captures 2024-12-05 19:11:33 +01:00
Lukas Wirth
f3d7415bd6 Parse lifetime bounds in lifetime param into TypeBoundList
This mainly aids in error recovery but also makes it a bit easier to handle lifetime resolution.
While doing so it also came apparent that we were not actually lowering lifetime outlives relationships within lifetime parameter declaration bounds, so this fixes that.
2024-12-05 17:52:02 +01:00
Oli Scherer
a035c6c3fb Rename core_pattern_type and core_pattern_types lib feature gates to pattern_type_macro
That's what the gates are actually gating, and the single char difference in naming was not helpful either
2024-12-04 16:16:24 +00:00
Lukas Wirth
65c0b29720 Fix parsing of parenthesized type args and RTN 2024-12-04 11:48:47 +01:00
Lukas Wirth
64f56f458f Move text-edit into ide-db 2024-10-28 14:37:41 +01:00
Lukas Wirth
80e9d014be
Merge pull request #18074 from ChayimFriedman2/typeref-source-map
internal: Build source map for `hir_def::TypeRef`s
2024-10-28 11:01:12 +00:00
Lukas Wirth
20ac30fb75 Invert token iteration order in macro mapping 2024-10-27 11:32:12 +01:00
Lukas Wirth
ca3699bd50 Factor out token ranking 2024-10-25 12:03:12 +02:00