about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/ide
AgeCommit message (Collapse)AuthorLines
2024-08-07Auto merge of #17813 - roife:fix-issue-17803, r=Veykrilbors-1/+24
fix: tyck for non-ADT types when searching refs for `Self` kw See https://github.com/rust-lang/rust-analyzer/pull/15864/files/e0276dc5ddc38c65240edb408522bb869f15afb4#r1389848845 For ADTs, to handle `{error}` in generic args, we should to convert them to ADT for comparisons; for others, we can directly compare the types.
2024-08-06fix: tyck for non-ADT types when searching refs for `Self` kwroife-1/+24
2024-08-06Include vendored crates in StaticIndexNicolas Guichard-10/+36
StaticIndex::compute filters out modules from libraries. This makes an exceptions for vendored libraries, ie libraries actually defined inside the workspace being indexed. This aims to solve https://bugzilla.mozilla.org/show_bug.cgi?id=1846041 In general StaticIndex is meant for code browsers, which likely want to index all visible source files.
2024-08-06Replace `[package.repository] = "…"` of published crates with ↵Vincent Esche-1/+1
`[package.repository.workspace] = true`
2024-08-06Add repository URL for published crates' missing `[package.repository]` fieldsVincent Esche-0/+1
2024-08-06Replace `"TBD"` with more helpful desciptions in published crates' ↵Vincent Esche-1/+1
`[package.description]` fields
2024-08-05Auto merge of #17775 - ShoyuVanilla:segregate-diags, r=Veykrilbors-4/+23
perf: Segregate syntax and semantic diagnostics Closes #17731
2024-08-05perf: Segregate syntax and semantic diagnosticsShoyu Vanilla-4/+23
2024-08-05Auto merge of #17784 - Young-Flash:block_with_label, r=Veykrilbors-3/+31
feat: support inlay hint for more expr with label follow up https://github.com/rust-lang/rust-analyzer/pull/17635
2024-08-05SimplifyLukas Wirth-7/+1
2024-08-05Simplify FileDelegateLukas Wirth-7/+7
2024-08-04test: add test case for inlay hint support for expr with labelYoung-Flash-0/+13
2024-08-01feat: support inlay hint for more expr with labelYoung-Flash-3/+24
2024-07-29Auto merge of #17707 - Veykril:proc-macro-err-cleanup, r=Veykrilbors-63/+0
feat: Use spans for builtin and declarative macro expansion errors This should generally improve some error reporting for macro expansion errors. Especially for `compile_error!` within proc-macros
2024-07-28Fix for #17497 - Invalid RA diagnostic error: expected 2 arguments, found 1Francis McKenzie-1/+1
The issue occurs because in some configurations of traits where one of them has Deref as a supertrait, RA's type inference algorithm fails to resolve the Deref::Target type, and instead uses a TyKind::BoundVar (i.e. an unknown type). This "autoderefed" type then incorrectly acts as if it implements all traits in scope. The fix is to re-apply the same sanity-check that is done in iterate_method_candidates_with_autoref(), that is: don't try to resolve methods on unknown types. This same sanity-check is now done on each autoderefed type for which trait methods are about to be checked. If the autoderefed type is unknown, then the iterating of the trait methods for that type is skipped. Includes a unit test that only passes after applying the fixes in this commit. Includes a change to the assertion count in test syntax_highlighting::tests::benchmark_syntax_highlighting_parser as suggested by Lukas Wirth during review. Includes a change to the sanity-check code as suggested by Florian Diebold during review.
2024-07-26Internal: Cleanup proc-macro error handlingLukas Wirth-63/+0
2024-07-22internal: Shrink size of `Binding`Lukas Wirth-11/+21
2024-07-22Auto merge of #17542 - roife:fix-issue-17517, r=Veykrilbors-179/+1182
feat: go-to-def and find-references on control-flow keywords fix #17517. This PR implements **go-to-definition** and **find-references** functionalities for control flow keywords, which is similar to the behaviors in the `highlight-related` module. Besides, this PR also fixes some incorrect behaviors in `highlight-related`. ## Changes 1. **Support for go-to-definition on control flow keywords**: This PR introduces functionality allowing users to navigate on the definition of control flow keywords (`return`, `break`, `continue`). Commit: 2a3244ee147f898dd828c06352645ae1713c260f..7391e7a608634709db002a4cb09229de4d12c056. 2. **Bug fixes and refactoring in highlight-related**: - **Handling return/break/continue within try_blocks**: This PR adjusted the behavior of these keywords when they occur within `try_blocks`. When encounter these keywords, the program should exit the outer function or loop which containing the `try_blocks`, rather than the `try_blocks` itself; while the `?` will cause the program to exit `try_blocks`. Commit: 59d697e807f0197f59814b37dca1563959da4aa1. - **Support highlighting keywords in macro expansion for highlight-related**: Commit: 88df24f01727c23a667a763ee3ee0cec22d5ad52. - Detailed description for the bug fixes + The previous implementation of `preorder_expr` incorrectly treated `try_blocks` as new contexts, thereby r-a will not continue to traverse inner `return` and `break/continue` statements. To resolve this, a new function `preorder_expr_with_ctx_checker` has been added, allowing users to specify which expressions to skip. * For example, when searching for the `?` in the context, r-a should skip `try_blocks` where the `?` insides just works for `try_blocks`. But when search for the `return` keyword, r-a should collect both the `return` keywords inside and outside the `try_blocks` + Thus, this PR added `WalkExpandedExprCtx` (builder pattern). It offers the following improvements: customizable context skipping, maintenance of loop depth (for `break`/`continue`), and handling macro expansion during traversal. 3. **Support for find-references on control flow keywords**: This PR enables users to find all references to control flow keywords. Commit: 9202a33f81218fb9c2edb5d42e6b4de85b0323a8.
2024-07-21fix: Allow flyimport to import primitive shadowing modulesLukas Wirth-1/+3
2024-07-20Fix some typosLaurențiu Nicola-1/+2
2024-07-20minor: tweak commentYoung-Flash-1/+2
2024-07-20internal: add test case for inlay hint support for block expr with lifetime ↵Young-Flash-0/+23
label
2024-07-20feat: add inlay hint support for block expr with lifetime labelYoung-Flash-1/+8
2024-07-20internal: move NavigationTarget::from_expr to goto_definitionroife-27/+33
2024-07-20fix: sort references in testsroife-22/+97
2024-07-20fix: handle highlightings inside macro calls & only highlight kws in current ↵roife-220/+278
file
2024-07-20fix: ensure that highlight_related works for macro_exprroife-6/+13
2024-07-20use token_ancestors_with_macros to simplify goto-def on kwroife-83/+45
2024-07-20fix: navigate to label directly when perform 'goto-def' on control-flow kwroife-3/+3
See https://github.com/rust-lang/rust-analyzer/pull/17542#discussion_r1667656190
2024-07-20feat: find references on control-flow kwsroife-1/+253
2024-07-20fix: keyword highlighting in macro expansionroife-0/+133
2024-07-20fix: incorrect highlighting of try blocks with control flow kwsroife-123/+215
2024-07-20fix: ensure that goto-def works on fn/try/async kwroife-3/+9
2024-07-20feat: goto-def on keywordsroife-7/+419
2024-07-19Reduce maximum LRU size to 2^16 entries, reducing memory footprint of LRU ↵Lukas Wirth-3/+3
entries
2024-07-18Update test fixturesLukas Wirth-116/+116
2024-07-18Encode edition within FileId in the hir layerLukas Wirth-206/+245
2024-07-17Add always disabled gen parse supportLukas Wirth-2/+3
2024-07-16Remove Name::to_smol_strLukas Wirth-22/+30
2024-07-16More symbol usageLukas Wirth-11/+14
2024-07-16Use symbol in cfgLukas Wirth-4/+4
2024-07-15Auto merge of #17587 - joshka:jm/edit-name-after-refactor, r=Veykrilbors-5/+5
Trigger VSCode to rename after extract variable assist is applied When the user applies the "Extract Variable" assist, the cursor is positioned at the newly inserted variable. This commit adds a command to the assist that triggers the rename action in VSCode. This way, the user can quickly rename the variable after applying the assist. Fixes part of: #17579 https://github.com/user-attachments/assets/4cf38740-ab22-4b94-b0f1-eddd51c26c29 I haven't yet looked at the module or function extraction assists yet.
2024-07-14Use statics + clone instead of const until const can access staticsLukas Wirth-12/+3
2024-07-12Trigger VSCode to rename after extract variable assist is appliedbors-5/+5
When the user applies the "Extract Variable" assist, the cursor is positioned at the newly inserted variable. This commit adds a command to the assist that triggers the rename action in VSCode. This way, the user can quickly rename the variable after applying the assist. Fixes part of: #17579
2024-07-12Use Symbol in NameLukas Wirth-21/+13
2024-07-10Auto merge of #17572 - beetrees:f16-f128, r=Veykrilbors-7/+96
Add `f16` and `f128` support Adds `f16` and `f128` support, using the `rustc_apfloat` library (also used by `rustc`) for parsing/arithmetic/displaying since the types aren't stable yet so can't be used by rust-analyzer itself. Issue: #17451
2024-07-10Auto merge of #17544 - MikeWalrus:inlay-hint-generic-param-name, r=Veykrilbors-10/+363
feat: add inlay hints for generic parameters fixes #11091 By default, only hints for const generic parameters are shown, and this can be configured through `rust-analyzer.inlayHints.genericParameterHints.enable`. Probably needs more testing.
2024-07-10Add `f16` and `f128` supportbeetrees-7/+96
2024-07-08fix: Fix double rounding of `f32` literalsbeetrees-0/+22
2024-07-08feat: add inlay hints for generic parametersLiao Junxuan-10/+363
fixes #11091 By default, only hints for const generic parameters are shown.