about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-09-11Properly set the working directory for proc-macro executionLukas Wirth-5/+29
2024-09-11Auto merge of #17904 - darichey:unresolved-references, r=Veykrilbors-0/+200
Add command to report unresolved references Adds `rust-analyzer unresolved-references` which reports unresolved references. This is useful for debugging and regression testing for both rust-analyzer and project generators like Buck's rust-project. As discussed: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Command.20to.20report.20unresolved.20references
2024-09-11Lift out workspace related data into a separate query to preserve crategraph ↵Lukas Wirth-97/+98
deduplication
2024-09-11Auto merge of #18050 - rust-lang:davidbarsky/push-uyvtlsvoqrxw, r=Veykrilbors-9/+25
assist: ensure `replace_qualified_name_with_use` applies to the first path segment This change helps a bit with the discoverability of `replace_qualified_name_with_use`. Specifically, it ensures that a cursor on the first path segment (e.g., `$0std::fmt::Debug`, where `$0` is the cursor) would result in an import along the lines of `use std::fmt;` and `fmt::Debug;` at the usage sites.
2024-09-11Remove crate graph deduplication logicLukas Wirth-19658/+6
2024-09-11Auto merge of #18093 - ShoyuVanilla:skip-dyn-trait-cast-check, r=Veykrilbors-0/+139
Skip checks for cast to dyn traits It seems that chalk fails to solve some obvious goals when there are some recursiveness in trait environments. And it doesn't support trait upcasting yet. rust-lang/chalk#796 This PR just skips for casting into types containing `dyn Trait` to prevent false positive diagnostics like #18047 and #18083
2024-09-11Skip checks for cast to dyn traitsShoyu Vanilla-0/+139
2024-09-10Correctly escape strings in our quote macroChayim Refael Friedman-6/+25
This is a small change, but it was the cause of 90% of the errors in `rust-analyzer diagnostics .` 🫢 With this change and #18085 together, all remaining errors are type errors. This may mean we can enable more errors, but this is out of scope for this PR.
2024-09-10Auto merge of #18032 - DropDemBits:sed-tree-edits, r=davidbarskybors-0/+1251
internal: Add preliminary `SyntaxEditor` functionality Related to #15710 Implements a `SyntaxEditor` interface to abstract over the details of modifying syntax trees, to both simplify creating new code fixes and code actions, as well as start on the path of getting rid of mutable syntax nodes. `SyntaxEditor` relies on `SyntaxMappingBuilder`s to feed in the correct information to map AST nodes created by `make` constructors, as `make` constructors do not guarantee that node identity is preserved. This is to paper over the fact that `make` constructors simply re-parse text input instead of building AST nodes from the ground up and re-using the provided syntax nodes. `SyntaxAnnotation`s are used to find where syntax elements have ended up after edits are applied. This is primarily useful for the `add_{placeholder,tabstop}` set of methods on `SourceChangeBuilder`, as that currently relies on the nodes provided being in the final syntax tree. Eventually, the goal should be to move this into the `rowan` crate when we move away from mutable syntax nodes, but for now it'll stay in the `syntax` crate. --- Closes #14921 as `SyntaxEditor` ensures that all replace changes are disjoint Closes #9649 by implementing `SyntaxAnnotation`s
2024-09-10feat: generate names for tuple-struct in add-missing-match-armsroife-24/+106
2024-09-10refactor: introduce NameGenerator in suggest_nameroife-81/+192
2024-09-09feat: use shorthand when pretty-print record patroife-6/+79
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-09fix: add parenthesis for or-patternroife-1/+18
2024-09-09fix: use `pretty_print_pat` for params in fnroife-5/+123
2024-09-09feat: add prettifier for Patroife-0/+31
2024-09-09feat: Allow hir-def prettifier formatting into one-lineroife-15/+55
2024-09-09Remove unnecessary symbols and add missing symbolscuishuang-3/+5
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-08Better testing infra for ratomlAli Bektas-103/+228
2024-09-08Automatically add semicolon when completing unit-returning functionsChayim Refael Friedman-40/+217
But provide a config to suppress that. I didn't check whether we are in statement expression position, because this is hard in completion (due to the natural incompleteness of source code when completion is invoked), and anyway using function returning unit as an argument to something seems... dubious.
2024-09-06Fix toolsMichael Goulet-0/+7
2024-09-06fix: Properly prevent mir building with unknown types presentLukas Wirth-5/+14
2024-09-06fix: Always explicitly set trait ref self types when loweringLukas Wirth-64/+80
2024-09-06Bump lsp-serverLukas Wirth-7/+7
2024-09-06Auto merge of #18066 - Veykril:lsp-server-no-panic, r=Veykrilbors-13/+11
fix: Don't panic lsp writer thread on dropped receiver Should reduce the noise a bit (https://github.com/rust-lang/rust-analyzer/issues/18055). This removes the panic (and a follow up panic) when the server incorrectly shuts down, turning it into a proper late exit error.
2024-09-06fix: Don't panic lsp writer thread on dropped receiverLukas Wirth-13/+11
2024-09-06Auto merge of #18065 - Veykril:catchy-diagnostics, r=Veykrilbors-12/+23
fix: Catch panics from diagnostics computation
2024-09-06fix: Catch panics from diagnostics computationLukas Wirth-12/+23
2024-09-05fix: Updating settings should not clobber discovered projectsWilfred Hughes-61/+85
`linkedProjects` is owned by the user's configuration, so when users update this setting, `linkedProjects` is reset. This is problematic when `linkedProjects` also contains projects discovered with `discoverCommand`. The buggy behaviour occurred when: (1) The user configures `discoverCommand` and loads a Rust project. (2) The user changes any setting in VS Code, so rust-analyzer receives `workspace/didChangeConfiguration`. (3) `handle_did_change_configuration` ultimately calls `Client::apply_change_with_sink()`, which updates `config.user_config` and discards any items we added in `linkedProjects`. Instead, separate out `discovered_projects_from_filesystem` and `discovered_projects_from_command` from user configuration, so user settings cannot affect any type of discovered project. This fixes the subtle issue mentioned here: https://github.com/rust-lang/rust-analyzer/pull/17246#issuecomment-2185259122
2024-09-05Add command to report unresolved referencesDavid Richey-0/+200
2024-09-05fix: Fix parser panicking on invalid asm optionsLukas Wirth-0/+6
2024-09-05asm! parsing and lowering fixesLukas Wirth-18/+106
2024-09-05Fix name fetching being incorrect for asm operandsLukas Wirth-93/+107
2024-09-05Add missing doc commentsLukas Wirth-0/+1
2024-09-05Support more IDE features for asm operandsLukas Wirth-40/+180
2024-09-05Give InlineAsmOperand a HIR representationLukas Wirth-217/+409
2024-09-05Add Definition kind for asm register operandLukas Wirth-35/+59
2024-09-05Add Definition kind for asm register classesLukas Wirth-28/+214
2024-09-05Lower asm expressionsLukas Wirth-97/+612
2024-09-05fix: Fix `inline_const_as_literal` error when the number >= 10coekjan-4/+14
2024-09-04assist: ensure replace_qualified_name_with_use applies to the first path segmentDavid Barsky-9/+25
2024-09-04Parse builtin#asm expressionsLukas Wirth-31/+865
2024-09-04Auto merge of #18045 - Veykril:fix-loop-lower, r=Veykrilbors-9/+65
fix: Fix lowering of for loops dropping the loop block
2024-09-04fix: Fix lowering of for loops dropping the `loop` blockLukas Wirth-9/+65
2024-09-04Add edition dependent keyword highlighting testsLukas Wirth-7/+326
2024-09-03Add an internal lint that warns when accessing untracked dataNadrieril-0/+3
2024-09-03bundle old root into `SyntaxEdit` resultDropDemBits-12/+30
useful for `SourceChangeBuilder` so it can still perform a tree diff without having to store the old root separately
2024-09-03Bump smol_strLukas Wirth-4/+20
2024-09-03Auto merge of #17984 - ShoyuVanilla:cast, r=Veykrilbors-93/+1614
feat: Implement cast typecheck and diagnostics Fixes #17897 and fixes #16564 Mainly adopted from https://github.com/rust-lang/rust/blob/100fde5246bf56f22fb5cc85374dd841296fce0e/compiler/rustc_hir_typeck/src/cast.rs