Using `LSP_USE_PLISTS` with Rust Analyzer stops updating diagnostics on save

Goal : Make M-x lsp-doctor all green on plists

LSP-mode advises using plists instead of hash-tables for deserialization of JSON messages.

I’ve been trying to set this up, and I think I got mostly there but I’m still unsure as I have a couple bugs still (typing/saving buffers do not trigger the file watchers or the notifications to update the flycheck messages and lsp-ui, so I keep stale overlays/popup until I M-x lsp-workspace-restart)

What I’ve done:

  • Clear the already built versions of lsp-mode related packages. You need to rebuild the packages with a specific environment variable and the only way to make Doom CLI notice is to nuke it
    rm -rf .config/emacs/.local/straight/repos/lsp-* .config/emacs/.local/straight/build-*/lsp-* .config/emacs/.local/straight/repos/rust* .config/emacs/.local/straight/build-*/rust*
    I also deleted the rust related packages since I’m mostly using rust but YMMV
  • Add the configuration line in your config (I just used vim or nano for the quick edit)
    ;; In your config.el
    (setq lsp-use-plists "true")
  • Rebuild all the nuked packages
    LSP_USE_PLISTS=true doom sync

And now hopefully it should work, since the env that built the packages got snapshot at the sync call.

Closing notes

I think there are some mistakes in that flow for 2 reasons :

  • I still get spurious (wrong-type-error hash-table-p ....) errors sometimes, which tell me that some places still don’t know that I’m using plists. That’s the reason I got this PR to consult-lsp, but I never know if the problem is my config or my packages, it’s annoying.
  • My flycheck errors aren’t updating on save. I’m somewhat assuming that this issue is related to trying to use plists, but I need to test without plists to be sure. I’m also increasingly annoyed by rust-analyzer as a LSP server, breaking changes aren’t handled in a way that makes it easy to dodge, each update of either lsp-mode or rust-analyzer is like playing russian roulette… That also means my “on save” issues might just be coming by yet another change in RA.

If anyone got something satisfying working I’d be happy to see it.

Seems like it needs $LSP_USE_PLISTS set at both compile and runtime, so try this instead:

;;; in $DOOMDIR/init.el
(setenv "LSP_USE_PLISTS" "1")

Then delete lsp-mode manually, $ doom sync, and restart Emacs.

(This should also propagate to the flycheck checker)

This does indeed seem to work!

This is also happening for me. I’m getting syntax errors, but not type errors nor warnings. Not sure if it’s RA or the plists.

Update: After reverting the plist usage, I have full rust-analyzer functionality back.

Indeed, with plists set up, it seems that even after a save, the server doesn’t send the notification for the diagnostics.

To repro:

  • (setq lsp-log-io t)
  • Open a Rust buffer
  • Let the initialization finish
  • Delete a character in an identifier so that the name is obviously false (like replace a to_string() call with to_strin())
  • Save the buffer


  • In the *lsp-log: rust-analyzer:PID* buffer, we see the message about "Received notification ‘textDocument/publishDiagnostics’.`


  • There is only a single “Received notification ‘textDocument/publishDiagnostics’.” entry in the log, corresponding to the first notification sent by the server after initialization

Just to be complete, I’m using the 2022-06-20 tagged release of rust-analyzer

(At this point, I’ll probably edit the title and the tags of the post)

Here is the initialization payloads under plists:

For the record, I have the 2022-06-27 version and was seeing the same issue.

Turns out, it was a regression specific to plists and Rust-Analyzer.

Yyoncho found the issue with my report, and the fix is there Fix Rust Analyzer when using plists by yyoncho · Pull Request #3599 · emacs-lsp/lsp-mode · GitHub (to be tested, but I have high confidence)

1 Like

I have confirmed the fix. Thanks @gagbo !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.