about summary refs log tree commit diff
path: root/src/tools/rust-analyzer
AgeCommit message (Collapse)AuthorLines
2024-10-14Auto merge of #18217 - ChayimFriedman2:cast-unknown-ptr, r=Veykrilbors-25/+48
fix: Comment out cast checks for unknown ptr kind Just like we don't check for types containing unknown. Fixes #18214. See also https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Another.20case.20of.20.2318064.3F.
2024-10-14Auto merge of #18152 - CryZe:highlight-async-block-exit-points, r=Veykrilbors-73/+101
feat: Highlight exit points of async blocks Async blocks act similar to async functions in that the await keywords are related, but also act like functions where the exit points are related. Fixes #18147
2024-10-14Auto merge of #18226 - SabrinaJewson:fix-impl-use, r=Veykrilbors-1/+29
Correctly parse `use` in generic parameters Fixes: #18225
2024-10-13Add wrap/unwrap return type in OptionGiga Bowser-0/+2348
2024-10-13feat: respect references.exclude_tests in call-hierarchyroife-20/+141
2024-10-12Auto merge of #18281 - darichey:async-subprocess, r=lnicolabors-32/+83
Run subprocesses async in vscode extension Extensions should not block the vscode extension host. Replace uses of `spawnSync` with `spawnAsync`, a convenience wrapper around `spawn`. These `spawnSync`s are unlikely to cause a real issue in practice, because they spawn very short-lived processes, so we aren't blocking for very long. That said, blocking the extension host is poor practice, and if they _do_ block for too long for whatever reason, vscode becomes useless.
2024-10-12Fix panic when json project has relative buildfile pathsDavid Richey-1/+1
2024-10-10Run subprocesses async in vscode extensionDavid Richey-32/+83
2024-10-09Skip #[test_case] expansionDavid Richey-2/+5
2024-10-09Auto merge of #18245 - boattime:master, r=davidbarskybors-2/+2
fix: include description in label details when detail field is marked for … Fixes https://github.com/rust-lang/rust-analyzer/issues/18231. When omitting the autocomplete detail field, the autocomplete label details can still be returned. Currently the label details are missing the description field if the detail field is included in resolveSupport since it is being overwritten as None and opted to be sent with `completionItem/resolve`. Example completion capabilities. ``` completion = { completionItem = { commitCharactersSupport = true, deprecatedSupport = true, documentationFormat = { "markdown", "plaintext" }, insertReplaceSupport = true, insertTextModeSupport = { valueSet = { 1, 2 } }, labelDetailsSupport = true, preselectSupport = true, resolveSupport = { properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextFormat", "insertTextMode" } }, snippetSupport = true, tagSupport = { valueSet = { 1 } } } ```
2024-10-09Auto merge of #18247 - jhgg:lsp/fix-something-to-resolve, r=Veykrilbors-7/+7
lsp: fix completion_item something_to_resolve not being a latch to true while looking at #18245 i noticed that `something_to_resolve` could technically flap between true -> false if some subsequent fields that were requested to be resolved were empty. this fixes that by using `|=` instead of `=` when assigning to `something_to_resolve` which will prevent it from going back to false once set. although some cases it's simply assigning to `true` i opted to continue to use `|=` there for uniformity sake. but happy to change those back to `=`'s. cc `@SomeoneToIgnore`
2024-10-09Auto merge of #18246 - ChayimFriedman2:fix-18238, r=Veykrilbors-1/+34
fix: Fix `prettify_macro_expansion()` when the node isn't the whole file Fixes #18238.
2024-10-08Reserve guarded string literals (RFC 3593)Peter Jaszkowiak-0/+6
2024-10-08Only Highlight Exit Points on `async` TokenChristopher Serr-7/+13
This ensures that when being on an `await` token, it still only highlights the yield points and not the exit points.
2024-10-08include fn prefix for all callable defsJake-36/+29
2024-10-08hir-ty: change struct constructor formatting.Jake-53/+54
before, when formatting struct constructor for `struct S(usize, usize)` it would format as: extern "rust-call" S(usize, usize) -> S but after this change, we'll format as: fn S(usize, usize) -> S
2024-10-08Merge from rust-lang/rustLaurențiu Nicola-0/+7
2024-10-08Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2024-10-08Use macos-13 runners and bump MACOSX_DEPLOYMENT_TARGETLaurențiu Nicola-3/+3
2024-10-08prettier formatkouhe3-14/+13
2024-10-08semicolonkouhe3-1/+1
2024-10-08fix array sourceMapkouhe3-9/+19
2024-10-08lldbdap env dict to stringkouhe3-2/+3
2024-10-08add knownEngines lldb-dapkouhe3-0/+20
2024-10-06Use external stack in borrowck DFSChayim Refael Friedman-58/+67
Because damnit, it can crash r-a. Why do people make this stupid DFSes anyway (I get it, it's easier until it blows).
2024-10-07fix: Do not consider mutable usage of deref to `*mut T` as deref_mutShoyu Vanilla-1/+37
2024-10-05lsp: fix completion_item something_to_resolve not being a latch to trueJake-7/+7
2024-10-05Fix `prettify_macro_expansion()` when the node isn't the whole fileChayim Refael Friedman-1/+34
2024-10-05Include description in label details when detail field is marked for resolutionMax-2/+2
2024-10-05Fix IDE layer not correctly resolving opt-in extern cratesLukas Wirth-7/+18
2024-10-05Add excluded extern-prelude IDE resolution testLukas Wirth-3/+9
2024-10-05Turn ImportSource into a structLukas Wirth-46/+54
2024-10-05Remove ImportSource::ExternCrate as the fixed point loop can't affect itLukas Wirth-138/+102
2024-10-04Auto merge of #18227 - davidbarsky:davidbarsky/push-lmntvwvznyyx, r=davidbarskybors-62/+190
internal: add json `tracing` Layer for profiling startup On `buck2/integrations/rust-project`, this results in the following being printed: ```json {"name":"discover_command","elapsed_ms":18703} {"name":"parallel_prime_caches","elapsed_ms":0} {"name":"vfs_load","elapsed_ms":5895} {"name":"vfs_load","elapsed_ms":547} {"name":"parallel_prime_caches","elapsed_ms":23} {"name":"parallel_prime_caches","elapsed_ms":84} {"name":"parallel_prime_caches","elapsed_ms":5819} ```
2024-10-04internal: add JSON formatting for hprofDavid Barsky-62/+190
2024-10-04Auto merge of #18234 - Veykril:veykril/push-vzynqtlxmrnl, r=Veykrilbors-70/+114
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-70/+114
2024-10-02fix: Join rustfmt overrideCommand with project rootKajetan Puchalski-3/+3
When providing a custom rustfmt command, join it with the project root instead of the workspace root. This fixes rust-analyzer getting the wrong invocation path in projects containing subprojects. This makes the behaviour consistent with how a custom path provided in rust-analyzer.procMacro.server behaves already. Resolves issue #18222
2024-10-01fix: correctly parse `use` in generic parametersSabrinaJewson-1/+29
2024-10-01Auto merge of #18219 - Veykril:veykril/push-ytnzuvtoswqz, r=Veykrilbors-3/+4
fix: Fix bootstrap error message being incorrect precedence ...
2024-10-01fix: Fix bootstrap error message being incorrectLukas Wirth-3/+4
2024-10-01Fix: Handle block exprs as modules when finding their parentsShoyu Vanilla-7/+46
2024-09-30Comment out cast checks for unknown ptr kindChayim Refael Friedman-25/+48
Just like we don't check for types containing unknown.
2024-09-30internal: remove `Default` from OpQueueDavid Barsky-24/+40
2024-09-30Auto merge of #18210 - ChayimFriedman2:label-macro, r=Veykrilbors-27/+71
fix: Fix resolution of label inside macro When working on Something Else (TM) (I left a hint in the commits :P), I noticed to my surprise that labels inside macros are not resolved. This led to a discovery of *two* unrelated bugs, which are hereby fixed in two commits.
2024-09-30When resolving labels in `break` and `continue` for the IDE, do not resolve ↵Chayim Refael Friedman-24/+40
them textually, instead reuse the results of HIR lowering This fixes a bug where labels inside macros were not resolved, but more importantly this prepares us to a future where we have hygiene, and textual equivalence isn't enough to resolve identifiers.
2024-09-30Auto merge of #18167 - SomeoneToIgnore:fat-completions, r=Veykrilbors-75/+226
internal: Send less data during `textDocument/completion` if possible Similar to https://github.com/rust-lang/rust-analyzer/pull/15522, stops sending extra data during `textDocument/completion` if that data was set in the client completions resolve capabilities, and sends those only during `completionItem/resolve` requests. Currently, rust-analyzer sends back all fields (including potentially huge docs) for every completion item which might get large. Same as the other one, this PR aims to keep the changes minimal and does not remove extra computations for such fields — instead, it just filters them out before sending to the client. The PR omits primitive, boolean and integer, types such as `deprecated`, `preselect`, `insertTextFormat`, `insertTextMode`, etc. AND `additionalTextEdits` — this one looks very dangerous to compute for each completion item (as the spec says we ought to if there's no corresponding resolve capabilities provided) due to the diff computations and the fact that this code had been in the resolution for some time. It would be good to resolve this lazily too, please let me know if it's ok to do. When tested with Zed which only defines `documentation` and `additionalTextEdits` in its client completion resolve capabilities, rust-analyzer starts to send almost 3 times less characters: Request: ```json {"jsonrpc":"2.0","id":104,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///Users/someonetoignore/work/rust-analyzer/crates/ide/src/inlay_hints.rs"},"position":{"line":90,"character":14},"context":{"triggerKind":1}}} ``` <img width="1338" alt="image" src="https://github.com/user-attachments/assets/104f19b5-7095-4fc1-b008-5d829623b2e2"> Before: 381944 characters [before.json](https://github.com/user-attachments/files/17092385/before.json) After: 140503 characters [after.json](https://github.com/user-attachments/files/17092386/after.json) After Zed's [patch](https://github.com/zed-industries/zed/pull/18212) to enable all resolving possible: 84452 characters [after-after.json](https://github.com/user-attachments/files/17092755/after-after.json)
2024-09-30Auto merge of #18207 - mbwilding:master, r=Veykrilbors-21/+21
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-30Auto merge of #18085 - ChayimFriedman2:gate-test, r=Veykrilbors-18/+109
feat: Provide an config option to not set `cfg(test)` Fixes #17957.
2024-09-30Gate `#[test]` expansion under `cfg(test)`.Chayim Refael Friedman-45/+78
This will mean users opting to not activate `cfg(test)` will lose IDE experience on them, which is quite unfortunate, but this is unavoidable if we want to avoid false positives on e.g. diagnostics. The real fix is to provide IDE experience even for cfg'ed out code, but this is out of scope for this PR.