Commit graph

1178 commits

Author SHA1 Message Date
Lukas Wirth
de7808bb71 internal: Don't serialize empty fields in completions and resolve payloads 2024-12-16 11:25:29 +01:00
Sam Estep
33f7d1dae1 Fix publish workflow link in manual 2024-12-11 14:35:36 -05:00
Kirill Bulatov
4169926b3f Address the feedback from pascalkuthe
* Use Base64 to minify the hash representation in the JSON data
* Do hash checks only for items with similar labels
2024-12-10 13:01:23 +02:00
Kirill Bulatov
d348ffb480 Always compute the hash when r-a wants the imports to be resolved 2024-12-09 22:26:00 +02:00
Kirill Bulatov
62d97d9ba7 Draft completion hashing 2024-12-09 22:26:00 +02:00
Lukas Wirth
f021ec3b96 Disable pipe on typing handler 2024-12-09 15:52:04 +01:00
Lukas Wirth
54dbf1b446 Add typing handler for param list pipe 2024-12-06 15:49:36 +01:00
Lukas Wirth
bac0ed579f Make bracket typing handler work on more things 2024-12-06 12:47:32 +01:00
Lukas Wirth
d71e41dba6 Disable < typing handler again 2024-12-05 09:46:23 +01:00
Tarek
9aff46632e chore: deprecate typing.autoClosingAngleBrackets configuration
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-03 22:38:51 +02:00
Tarek
d6b701e251 internal: Make exclude characters for typing assists configurable, default to None
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-03 22:38:51 +02:00
Laurențiu Nicola
8d5e91c94f
Merge pull request #18511 from darichey/sysroot-query-metadata
Re-add `rust-analyzer.cargo.sysrootQueryMetadata`
2024-11-26 15:11:44 +00:00
Mark Murphy
9f73787b98
Update request entry point file path in architecture.md 2024-11-23 13:46:40 -05:00
David Richey
3c98b98ca7 Re-add rust-analyzer.cargo.sysrootQueryMetadata 2024-11-18 16:29:33 -06:00
Kirill Bulatov
4b621e030a Update the file hash 2024-11-11 16:06:55 +01:00
Sam Estep
6da2cc272f Replace with C-Architecture 2024-11-10 13:34:26 -05:00
Sam Estep
d1da09acf5 Delete design label from list 2024-11-07 11:49:22 -05:00
Lukas Wirth
cd206f5c9b
Merge pull request #18304 from davidkurilla/docs-create-setup-document
docs: create setup documentation
2024-10-30 09:52:39 +00:00
David Kurilla
0719432903 docs: remove unnecessary prerequisites setup.md 2024-10-22 08:48:09 -07:00
Lukas Wirth
70d0b57cf0 Update ide tests 2024-10-21 11:28:19 +02:00
David Kurilla
9ee29f4254 style: fix typos 2024-10-18 14:58:43 -07:00
David Kurilla
df14c010be docs: create setup documentation 2024-10-18 14:58:43 -07:00
roife
b7ed8150a3 feat: respect references.exclude_tests in call-hierarchy 2024-10-13 05:19:28 +08:00
David Barsky
56c10ca981 internal: add JSON formatting for hprof 2024-10-04 11:26:15 -04:00
bors
dfe6d503b8 Auto merge of #18167 - SomeoneToIgnore:fat-completions, r=Veykril
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-30 08:36:54 +00:00
bors
ceee056af6 Auto merge of #18085 - ChayimFriedman2:gate-test, r=Veykril
feat: Provide an config option to not set `cfg(test)`

Fixes #17957.
2024-09-30 06:32:20 +00:00
Chayim Refael Friedman
4ea09dd9f6 Provide an config option to not set cfg(test) 2024-09-30 00:12:45 +03:00
Noah Bright
4255cae1bb Rename object_safety to dyn_compatibility
Up to a trait implemented by another package, linking to
$CARGO_HOME/registry/cache/index.crates.io-6f17d22bba15001f/
2024-09-29 07:26:45 -04:00
Noah Bright
01aaa53ef2 Update handlers.rs to handlers/requests.rs 2024-09-28 06:17:22 -04:00
Kirill Bulatov
01ad453285 Fix the test 2024-09-23 05:51:38 +03:00
bors
0267296278 Auto merge of #18057 - alibektas:better_ratoml_testing, r=Veykril
internal: Better testing infra for ratoml

This PR makes some improvements on how we test configs that come from `rust-analyzer.toml` files.
It was primarily used to solve #18021 but along the way I could not really determine the cause of the said issue which makes me think that it may not be related to the changes that I made earlier to the ratoml infra. In either way `custom_snippets` are now made `global` because we still don't have a tree that maps a `SourceRootId` to a set of `Snippet`s.
2024-09-11 11:02:50 +00:00
Ali Bektas
31ed8c9361 Better testing infra for ratoml 2024-09-08 23:40:38 +02:00
Chayim Refael Friedman
779a7cb0e3 Automatically add semicolon when completing unit-returning functions
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-08 23:41:16 +03:00
Chayim Refael Friedman
01cc847158 Provide an option to hide deprecated items from completion 2024-09-01 01:04:21 +03:00
Lukas Wirth
5ca5d52697 Improve inlay hint resolution reliability 2024-08-30 15:57:52 +02:00
bors
ae420e353e Auto merge of #17857 - ChayimFriedman2:rust-project-cfg-group, r=Veykril
feat: Allow declaring cfg groups in rust-project.json, to help sharing common cfgs

Closes #17815.
2024-08-23 10:01:35 +00:00
Lukas Wirth
3c4cdbbd1a Improve documentation for InvocationStrategy 2024-08-19 14:23:05 +02:00
Victor Song
b0f20c7deb chore(config): remove invocationLocation in favor of invocationStrategy
These flags were added to help rust-analyzer integrate with repos
requiring non-Cargo invocations. The consensus is that having two
independent settings are no longer needed. This change removes
`invocationLocation` in favor of `invocationStrategy` and changes
the internal representation of `InvocationStrategy::Once` to hold
the workspace root.
2024-08-19 02:25:40 -05:00
Chayim Refael Friedman
2607c09fdd Allow declaring cfg groups in rust-project.json, to help sharing common cfgs 2024-08-12 22:03:16 +03:00
Lukas Wirth
da3f7d55eb internal: Reply to requests with defaults when vfs is still loading 2024-08-12 12:05:15 +02:00
bors
b4571d7c00 Auto merge of #17793 - jjoeldaniel:msvc-docs, r=Veykril
docs: add msvc note to manual

Added note for Windows users to have the latest MSVC to minimize setup issues.

Closes #4870
2024-08-05 12:17:25 +00:00
Lukas Wirth
f053b1aa6a feat: Load sysroot library via cargo metadata 2024-08-05 12:18:19 +02:00
Joel Daniel Rico
9f2a0e3e19 add msvc note to manual 2024-08-05 00:59:05 -07:00
Wilfred Hughes
e7d61e8f9c docs: Fix JSON example for rust-analyzer.workspace.discoverConfig
The user does not specify `{arg}` in their JSON, and be pedantic about
commas in JSON sample.
2024-07-31 16:10:42 -07:00
bors
a021b85be5 Auto merge of #17707 - Veykril:proc-macro-err-cleanup, r=Veykril
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-29 14:07:33 +00:00
Edward Jones
d10cdd25e7
docs: Reference cov_mark crate instead of test_utils/mark
Seems this was switched over in https://github.com/rust-lang/rust-analyzer/issues/7922
2024-07-26 22:49:11 -03:00
Lukas Wirth
7beac14cba Internal: Cleanup proc-macro error handling 2024-07-26 14:38:19 +02:00
David Barsky
2783aa7312 internal: remove UnindexedProject notification
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
2024-07-23 13:34:04 -04:00
PaulDotSH
49184a138c Remove lens.forceCustomCommands config 2024-07-23 03:27:28 -04:00
bors
52143a5ac0 Auto merge of #17246 - davidbarsky:david/move-rust-project-generation-to-server, r=Veykril
feature: teach rust-analyzer to discover `linked_projects`

This PR's been a long-time coming, but like the title says, it introduces server-side project discovery and removes the extension hooks I previously introduced. I don't think this PR is ready to land, but here are the things I'm feeling squishy about:
- I don't think I like the idea of introducing the `cargo-metadata` command-but-for-everything-else in the `flycheck` module, but the progress reporting infrastructure was too convenient to pass up. Happy to move it elsewhere.

Here are the things I _know_ I need to change:
- For progress reporting, I'm extracting from a `serde_json::Value` that corresponds to `tracing_subsciber::fmt::Layer`'s JSON output. I'd like to make this a bit more structured/documented than the current nonsense I wrote.
- The progress reporting currently hardcodes "Buck"; it should be deriving that from the previously mentioned more-structured-output.
- This doesn't handle *reloading* when a corresponding buildfile is changed. It should be doing that.

<details>
<summary>Anyway, here's a video of rust-analyzer discovering a Buck target.</summary>

https://github.com/rust-lang/rust-analyzer/assets/2067774/be6cd9b9-2c9a-402d-847f-05f860a91df1
</details>
2024-07-18 16:15:31 +00:00