-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Auto-imports broken in Emacs lsp-mode by commit 62d97d9 #18767
Comments
I confirm it reproduces since rust-analyzer 2024-12-16. |
Enabling client server message tracing reveals that response for Response of {
"isIncomplete": true,
"items": [
{
"label": "PanicInfo",
"labelDetails": {
"detail": " (use core::panic::PanicInfo)",
"description": "PanicInfo<'_>"
},
"kind": 22,
"deprecated": null,
"sortText": "80000000",
"filterText": "PanicInfo",
"textEdit": {
"newText": "PanicInfo",
"insert": {
"start": {
"line": 33,
"character": 4
},
"end": {
"line": 33,
"character": 5
}
},
"replace": {
"start": {
"line": 33,
"character": 4
},
"end": {
"line": 33,
"character": 5
}
}
},
"additionalTextEdits": [],
"data": {
"position": {
"textDocument": {
"uri": "file:///home/.../src/main.rs"
},
"position": {
"line": 33,
"character": 5
}
},
"imports": [
{
"full_import_path": "core::panic::PanicInfo",
"imported_name": "PanicInfo"
}
],
"version": 0,
"trigger_character": null,
"for_ref": null,
"hash": "aCm5vuCqiy5hrerIGGQuoh/1+nI="
}
},
... Update: My bad, it's not returned by r-a, it what lsp-mode has parsed from the response. |
If it errors because we sent |
My bad for not clarifying, it errors on the |
I assume we send the field populated with either So that is still an lsp-mode bug, it has no business modifying the resolve data payload |
It's more so of a problem with falsehood1 in ELisp, But for the Arguing further on the topic, that our 1: https://www.gnu.org/software/emacs/manual/html_node/eintr/Truth-_0026-Falsehood.html |
I think that's not true. The LSP spec is essentially Typescript type definitions, and I think an optional property has to be either present and with the correct type, or absent. Present and |
Well maybe, but that doesn't matter here either way, the issue is that lspmode turns |
Either way, in this instance we should should just be lenient on the resolve data (in fact we can omit the The fix in that case is to just put a |
The commit 62d97d9 ("Draft completion hashing") to rust-analyzer breaks the automatic adding of imports in Emacs + lsp-mode.
That commit, found via bisection, was part of this PR:
(Note that this is a second and seemingly-separate breakage from the earlier one that also affected Emacs + lsp-mode in #18653 and which was resolved in #18503.)
The behavior remains broken in the latest current commit to r-a (a77cf8e).
Others have also reported this breakage in #18363 (comment) (cc @xitep @monoid @noonebtw).
Testing procedure: Open a file in Emacs, start LSP, and type:
At and after commit 62d97d9, this does not cause
Pin
to be imported, and the following error is logged (after typing "Pin" and before making a selection):This is testing with lsp-mode version
20241227.533
at commit emacs-lsp/lsp-mode@9de4050.For details on how to set up an environment in a container suitable to reproduce this issue, see the instructions in #18504 (comment).
No assessment is being made in this report of whether r-a or lsp-mode is responsible, at a protocol level, for this regression.
cc @Veykril @SomeoneToIgnore
The text was updated successfully, but these errors were encountered: