Commit graph

105 commits

Author SHA1 Message Date
qjerome
c59ecb3af4
fix: autogenerate files 2025-01-08 14:47:21 +01:00
Lukas Wirth
05770f2599 target-triple -> target-tuple 2025-01-07 14:25:43 +01:00
Lukas Wirth
764ce49445 Remove rust-analyzer.cargo.sysrootQueryMetadata config again 2025-01-07 14:00:22 +01:00
Lukas Wirth
0389235a15 fix: Be more permissive with completion resolve data 2025-01-06 11:22:42 +01:00
Lukas Wirth
74d0d4e050
Merge pull request #18179 from ChayimFriedman2/omit-trait-completion
feat: Allow excluding specific traits from completion
2025-01-01 14:34:56 +00:00
Lukas Wirth
c84d09a7c3 Revamp auto-import exclude config 2025-01-01 15:06:44 +01:00
Lukas Wirth
13af22df98 Reduce the default autoimport exclusion list 2025-01-01 14:32:45 +01:00
Chayim Refael Friedman
bd6ea14002 Allow excluding specific traits from completion
To be accurate, only their methods are excluded, the trait themselves are still available.

I also excluded a bunch of std traits by default. Some less opinionated, like `AsRef`, which should never be used directly except in generic scenarios (and won't be excluded there), some more opinionated, like the ops traits, which I know some users sometimes want to use directly. Either way it's configurable.

It should be pretty easy to extend support to excluding only specific methods, but I didn't do that currently.

Traits configured to be excluded are resolved in each completion request from scratch. If this proves too expensive, it is easy enough to cache them in the DB.
2025-01-01 13:49:35 +01:00
roife
c8f29aad5e fix incorrect name for UpdateTest config 2024-12-26 19:51:14 +08:00
roife
2bfa83beb3 feat: add config UpdateTest to hover actions 2024-12-26 19:51:14 +08:00
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