-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stable(not yet) backport] Revert r-a completions breakage #133476
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
needs approval from r-a team before merging |
I believe it should be possible, in the rustc repo, to apply |
So here's what I've tried: had taken a rust-lang/rust-analyzer@81636f1 commit of mine and tried to revert it:
|
✌️ @BoxyUwU, you can now approve this pull request! If @davidbarsky told you to " |
@SomeoneToIgnore That is because, slightly confusingly, that is a different commitish: $ git log --author "Kirill"
commit 7347beed8876e73de345dcf6c70360ee96ec3631
Author: Kirill Podoprigora <[email protected]>
Date: Wed Nov 13 22:35:39 2024 +0200
Add test cases
commit 81f61058519a408ca8d55e87435f092cc967de8b
Author: Kirill Podoprigora <[email protected]>
Date: Wed Nov 13 15:31:07 2024 +0200
Address review
commit 98a71766b8b6ece6fabb8429e5fe53805ba28b78
Author: Kirill Podoprigora <[email protected]>
Date: Wed Nov 13 15:05:31 2024 +0200
Add ``exact-llvm-major-version`` directive
commit e646263abc74ac6b1bba4cb5a1da99e101a59412
Author: Kirill Bulatov <[email protected]>
Date: Mon Nov 11 16:06:55 2024 +0100
Update the file hash
commit 572ae698be3bea00d8ed4ec927c7fa0220f9ceaf
Author: Kirill Bulatov <[email protected]>
Date: Mon Nov 11 15:50:04 2024 +0100
Use completion item indices instead of property matching when searching for the completion item to resolve |
22aa3d3
to
64a8db6
Compare
I've updated the hash in a separate commit: 64a8db6 The hash value is taken from the corresponding test in the r-a:
|
The revert of 572ae69 applies cleanly so we just need to refind the ishes. |
64a8db6
to
1fa2adf
Compare
Thank you, I've found and reverted all commits properly + cherry-picked the hash change commit on top. |
I think unsquashed is fine. Perhaps reverting the merge commits would have been more to-the-point but I didn't explain how to find those (because it took a moment to remember how, honestly ^^;). $ git log --merges --grep "SomeoneToIgnore"
commit 61dba0292dd2786ba4019090d26999d7afcfcd90
Merge: c2ffafdc9a7 e646263abc7
Author: Laurențiu Nicola <[email protected]>
Date: Mon Nov 11 16:31:11 2024 +0000
Merge pull request #18503 from SomeoneToIgnore/kb/better-resolve-indexing
Use completion item indices instead of property matching when searching for the completion item to resolve
commit f075375e65a733ec23dd20ce8baed68059b5a713
Merge: 0790356a0ce 1a93651b8c5
Author: bors <[email protected]>
Date: Sat Oct 19 04:55:39 2024 +0000
Auto merge of #18335 - SomeoneToIgnore:editorconfig-glob, r=lnicola
internal: Fix editorconfig glob
Had been testing Zed's editorconfig branch on r-a and noticed that something was odd with yaml files.
https://spec.editorconfig.org/#glob-expressions
> {s1,s2,s3}
> any of the strings given (separated by commas, can be nested) (But {s1} only matches {s1} literally.)
commit 3e42fc55962fa19557ee2a34de192adebce11c47
Merge: bd1c7e99d69 5544bf54e35
Author: bors <[email protected]>
Date: Wed Oct 9 15:35:33 2024 +0000
Auto merge of #18247 - jhgg:lsp/fix-something-to-resolve, r=Veykril
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`
commit 4800a0eef7547674b96c8462846aac4fb655c1d8
Merge: 6938084f7e7 536ac471c47
Author: bors <[email protected]>
Date: Mon Sep 30 08:36:54 2024 +0000
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) |
Sorry, I've had to push the correct hash and now ensured that
so I cannot be sure that things are correct. |
1fa2adf
to
f7c53a2
Compare
Trying the build (locally) |
@SomeoneToIgnore On my end, the following commands work and pass without issue:
Although I didn't set the |
Thank you, this way it all builds and the tests pass indeed.
|
I think the answer is no, but how to set things up so that you are using that version so you can test the runtime interactions may be a question that @davidbarsky may be able to answer? I am not sure. |
The currently released stable does not have |
Does that make sense if we just change back to the following code? let Some(mut resolved_completion) = resolved_completions.into_iter().find(|completion| {
completion.label == original_completion.label
&& completion.kind == original_completion.kind
&& completion.deprecated == original_completion.deprecated
&& completion.preselect == original_completion.preselect
&& completion.sort_text == original_completion.sort_text
}) else {
return Ok(original_completion);
}; |
This is exactly what I've proposed in rust-lang/rust-analyzer#18503 (comment) Even more sense would be to fix nvim and helix, but... |
@bors r=BoxyUwU,davidbarsky rollup=never p=20 |
@bors p=100 |
☀️ Test successful - checks-actions |
Repeats the revert to `stable` rust-lang#133476 using https://patch-diff.githubusercontent.com/raw/rust-lang/rust/pull/133476.diff
[beta] Revert r-a completions breakage As suggested by `@cuviper` in https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Completion.20IDs/near/484770216 Repeats the revert to `stable` rust-lang#133476 using https://patch-diff.githubusercontent.com/raw/rust-lang/rust/pull/133476.diff cc `@BoxyUwU` `@workingjubilee`
This PR revers recent completion-related changes in r-a, which caused nvim and helix to malfunction.
Changes reverted:
textDocument/completion
if possible rust-analyzer#18167See rust-lang/rust-analyzer#18503 (comment) for more context
cc @BoxyUwU