about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/ide-db
AgeCommit message (Collapse)AuthorLines
2025-01-10Merge pull request #18902 from Veykril/push-znlsxykqrkooLukas Wirth-5/+19
internal: Add Definition::Crate
2025-01-10internal: Add Definition::CrateLukas Wirth-5/+19
This is its own thing so it should be handled specifically where possible
2025-01-10Remove two hir reexportsChayim Refael Friedman-16/+16
2025-01-06minor: New clippy lintsLukas Wirth-22/+17
2024-12-31Merge pull request #18758 from mgsloan/scip-unique-symbolsLukas Wirth-5/+49
Improve SCIP symbols
2024-12-30Move `container_to_definition` function into `enclosing_definition`Michael Sloan-19/+15
2024-12-30fix: avoid generating colliding names in extract_variableroife-68/+79
2024-12-25Improve SCIP symbolsMichael Sloan-5/+53
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-24Merge pull request #18707 from ChayimFriedman2/substLukas Wirth-64/+99
feat: Show substitution where hovering over generic things
2024-12-20Show substitution where hovering over generic thingsChayim Refael Friedman-64/+99
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-16fix: Fix path qualified auto-importing completions not working with re-exportsLukas Wirth-120/+152
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-13feat: improve name generation in destructure_tuple_bindingroife-0/+2
2024-12-13Bump typosLaurențiu Nicola-1/+1
2024-12-11Properly handle different defaults for severity of lintsChayim Refael Friedman-1267/+6155
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-11Merge from rust-lang/rustLaurențiu Nicola-11/+2
2024-12-10minor: enhance name suggestion for `Arc<T>` and `Rc<T>`roife-1/+27
2024-12-05fix: Resolve generic parameters within use capturesLukas Wirth-0/+7
2024-12-05Parse lifetime bounds in lifetime param into TypeBoundListLukas Wirth-10/+0
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-04Rename `core_pattern_type` and `core_pattern_types` lib feature gates to ↵Oli Scherer-11/+2
`pattern_type_macro` That's what the gates are actually gating, and the single char difference in naming was not helpful either
2024-12-04Fix parsing of parenthesized type args and RTNLukas Wirth-1/+2
2024-10-28Move text-edit into ide-dbLukas Wirth-9/+882
2024-10-28Merge pull request #18074 from ChayimFriedman2/typeref-source-mapLukas Wirth-0/+20
internal: Build source map for `hir_def::TypeRef`s
2024-10-27Invert token iteration order in macro mappingLukas Wirth-2/+4
2024-10-25Factor out token rankingLukas Wirth-0/+30
2024-10-25Fix memory usage calculation's queries listChayim Refael Friedman-0/+20
2024-10-22Auto merge of #18370 - duncpro:goto-def-ranges, r=Veykrilbors-2/+10
feat: resolve range patterns to their structs Closes #18367
2024-10-22Auto merge of #18349 - dqkqd:issue-18344, r=Veykrilbors-1/+13
feat: render docs from aliased type when type has no docs Trying to close #18344 - [x] ~Find the docs by traversing upwards if the type itself has none but aliasing for another type that might have.~ - [x] Show docs from aliased type. - [x] Showing description that we are displaying documentation for different definition in hover box. ![image](https://github.com/user-attachments/assets/820d6f97-aa2c-4dc4-8a25-75746e32d950)
2024-10-22feat: render docs from aliased type when docs are missingKhanh Duong Quoc-1/+13
2024-10-22resolve range patterns to the their struct typesDuncan Proctor-2/+10
2024-10-21Move explicit range handling out of goto_definition, use OperatorClass insteadduncanproctor-22/+18
2024-10-21GotoDefinition on a Range or InclusiveRange operator will link to the struct ↵duncanproctor-1/+16
definition
2024-10-14chore: rename salsa to ra_salsaDavid Barsky-20/+22
2024-10-04Auto merge of #18234 - Veykril:veykril/push-vzynqtlxmrnl, r=Veykrilbors-3/+7
internal: Filter out opaque tokens in some IDE feature macro descensions
2024-10-04internal: Filter out opaque tokens in some of IDE feature macro descensionsLukas Wirth-3/+7
2024-09-30Auto merge of #18207 - mbwilding:master, r=Veykrilbors-1/+1
fix: Ambiguity with CamelCase diagnostic messages, align with rustc warnings Fixed diagnostic messages so they say UpperCamelCase rather than CamelCase, as it is ambiguous. Usually I'd call it PascalCase, but in the code base it is called UpperCamelCase so I left it with that naming choice. `rustc` says `upper camel case` also when the case is wrong ``` warning: trait `testThing` should have an upper camel case name --> src/main.rs:5:7 | 5 | trait testThing { | ^^^^^^^^^ help: convert the identifier to upper camel case: `TestThing` | = note: `#[warn(non_camel_case_types)]` on by default ``` This is in line with the UPPER_SNAKE_CASE diagnostic messages. https://github.com/rust-lang/rust-analyzer/blob/546339a7be357b3e95fc4b79a8816dce540d477b/crates/hir-ty/src/diagnostics/decl_check.rs#L60 https://github.com/rust-lang/rust-analyzer/blob/546339a7be357b3e95fc4b79a8816dce540d477b/crates/ide-diagnostics/src/handlers/incorrect_case.rs#L535
2024-09-29Rename object_safety to dyn_compatibilityNoah Bright-2/+2
Up to a trait implemented by another package, linking to $CARGO_HOME/registry/cache/index.crates.io-6f17d22bba15001f/
2024-09-29Fix ambiguity with CamelCase diagnostic messagesMatthew Wilding-1/+1
2024-09-25Prime caches for symbol search too.Kevin Reid-0/+16
2024-09-24fix: Temporary fix for `remove_unused_imports` not handling import aliases ↵Shoyu Vanilla-3/+20
correctly
2024-09-18Auto merge of #18131 - ChayimFriedman2:macro-expand-dollar-crate, r=Veykrilbors-1/+1
fix: Get rid of `$crate` in expansions shown to the user Be it "Expand Macro Recursively", "Inline macro" or few other things. We replace it with the crate name, as should've always been. Probably fixes some issues, but I don't know what they are.
2024-09-18Get rid of `$crate` in expansions shown to the userChayim Refael Friedman-1/+1
Be it "Expand Macro Recursively", "Inline macro" or few other things. We replace it with the crate name, as should've always been.
2024-09-17internal: Extend `SourceChangeBuilder` to make make working with ↵DropDemBits-1/+95
`SyntaxEditor`s easier
2024-09-10refactor: introduce NameGenerator in suggest_nameroife-62/+150
2024-09-09Auto merge of #18041 - roife:fix-issue-17631, r=Veykrilbors-1/+95
feat: better name suggestions for fn fix #17631. Better name suggestions for fn-calls / method-calls in the form of `from()`, `from_xxx()`, `into()`, etc.
2024-09-09feat: better name suggestions for fnroife-1/+95
2024-09-05Support more IDE features for asm operandsLukas Wirth-6/+22
2024-09-05Give InlineAsmOperand a HIR representationLukas Wirth-26/+37
2024-09-05Add Definition kind for asm register operandLukas Wirth-4/+15
2024-09-05Add Definition kind for asm register classesLukas Wirth-3/+12
2024-09-03feat: suggest name in let_stmt and fn_paramroife-2/+16