Commit graph

95 commits

Author SHA1 Message Date
roife
60b4ed5bd3 feat: support UpdateTest in codelens 2024-12-26 19:50:32 +08:00
Lukas Wirth
8bfb2fe018
Merge pull request #18707 from ChayimFriedman2/subst
feat: Show substitution where hovering over generic things
2024-12-24 14:16:16 +00:00
Lukas Wirth
b08d1f93ce fix: Properly check if workspace flychecking is allowed 2024-12-22 12:10:48 +01:00
Chayim Refael Friedman
b80bb583e4 Show substitution where hovering over generic things
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-20 11:30:19 +02:00
Lukas Wirth
5c678215dd internal: Don't serialize empty fields in completions and resolve payloads 2024-12-16 11:25:29 +01:00
Sam Estep
ef879f7a74 Fix publish workflow link in manual 2024-12-11 14:35:36 -05:00
Kirill Bulatov
1ce15606f2 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
e8e3949698 Always compute the hash when r-a wants the imports to be resolved 2024-12-09 22:26:00 +02:00
Kirill Bulatov
cbc0069939 Draft completion hashing 2024-12-09 22:26:00 +02:00
Lukas Wirth
2ad6d7103c Disable pipe on typing handler 2024-12-09 15:52:04 +01:00
Lukas Wirth
3fe75c7d90 Add typing handler for param list pipe 2024-12-06 15:49:36 +01:00
Lukas Wirth
069fb0f475 Make bracket typing handler work on more things 2024-12-06 12:47:32 +01:00
Lukas Wirth
a9afc99c13 Disable < typing handler again 2024-12-05 09:46:23 +01:00
Tarek
68cd57940a chore: deprecate typing.autoClosingAngleBrackets configuration
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-03 22:38:51 +02:00
Tarek
b94c5355b2 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
4e3354ef92
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
a3efe3bc29
Update request entry point file path in architecture.md 2024-11-23 13:46:40 -05:00
David Richey
b4a31683c1 Re-add rust-analyzer.cargo.sysrootQueryMetadata 2024-11-18 16:29:33 -06:00
Kirill Bulatov
e646263abc Update the file hash 2024-11-11 16:06:55 +01:00
Sam Estep
29f84262a4 Replace with C-Architecture 2024-11-10 13:34:26 -05:00
Sam Estep
01726389fb Delete design label from list 2024-11-07 11:49:22 -05:00
Lukas Wirth
cee32578cb
Merge pull request #18304 from davidkurilla/docs-create-setup-document
docs: create setup documentation
2024-10-30 09:52:39 +00:00
David Kurilla
32b05c1a90 docs: remove unnecessary prerequisites setup.md 2024-10-22 08:48:09 -07:00
Lukas Wirth
e9da1dce05 Update ide tests 2024-10-21 11:28:19 +02:00
David Kurilla
be7865e904 style: fix typos 2024-10-18 14:58:43 -07:00
David Kurilla
2dfbcb6a46 docs: create setup documentation 2024-10-18 14:58:43 -07:00
roife
7bc615050f feat: respect references.exclude_tests in call-hierarchy 2024-10-13 05:19:28 +08:00
David Barsky
a5a4d1a95b internal: add JSON formatting for hprof 2024-10-04 11:26:15 -04:00
bors
4800a0eef7 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
1ca85ac706 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
923cb99142 Provide an config option to not set cfg(test) 2024-09-30 00:12:45 +03:00
Noah Bright
7b757b3e17 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
99b26382d8 Update handlers.rs to handlers/requests.rs 2024-09-28 06:17:22 -04:00
Kirill Bulatov
b24723a5c7 Fix the test 2024-09-23 05:51:38 +03:00
bors
e26ad2116d 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
81227a309c Better testing infra for ratoml 2024-09-08 23:40:38 +02:00
Chayim Refael Friedman
ca262a34ac 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
8116b62fd2 Provide an option to hide deprecated items from completion 2024-09-01 01:04:21 +03:00
Lukas Wirth
be33a2e1bd Improve inlay hint resolution reliability 2024-08-30 15:57:52 +02:00
bors
3a097e1659 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
b2062ea49f Improve documentation for InvocationStrategy 2024-08-19 14:23:05 +02:00
Victor Song
1bfb362d7f 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
aa6e8d3db5 Allow declaring cfg groups in rust-project.json, to help sharing common cfgs 2024-08-12 22:03:16 +03:00
Lukas Wirth
234d383f5f internal: Reply to requests with defaults when vfs is still loading 2024-08-12 12:05:15 +02:00
bors
56fe166028 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
ef7d2c5d65 feat: Load sysroot library via cargo metadata 2024-08-05 12:18:19 +02:00
Joel Daniel Rico
b6b4e1a9c5 add msvc note to manual 2024-08-05 00:59:05 -07:00
Wilfred Hughes
1df27d84a1 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
722f79d374 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
55964dad2a
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