Webview frontend becomes unresponsive when LSP mode is active

Open
#2,118 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
devtools, frontend

Research direction

Start by comparing the webview frontend’s JSON-RPC event handling with the ncurses frontend, using the Rust LSP setup and reproduction command in the issue. Check how diagnostic notifications and editor input are processed when LSP mode is active. The issue is resolved when the webview remains responsive with the provided configuration and the Rust document loads.

Written by the indexing model from the issue text.

Description

First, nice job on the webview front end. Love it.

Today when trying to get LSP to work with Rust I found that LSP mode is enabled (e.g., for Rust via define-language-spec in init.lisp + rust-analyzer), the webview frontend becomes completely unresponsive — no keyboard input, mouse clicks, or tab switching work. The ncurses frontend works fine with the same configuration

I walked through in general and found:

  • The editor thread is not blocked, I was able to make a heartbeat timer fires every 2 seconds normally if I add logging
  • LSP initialization completes successfully (server starts, initialize/initialized handshake, textDocument/didOpen all succeed)
  • Diagnostic notifications arrive and are processed correctly
  • The problem is specific to the webview/jsonrpc frontend — ncurses build worked fine

Reproduction, off of 15eb7c43c9f806028f3de6d3c7b1b6a338e4b7cd

Add to ~/.lem/init.lisp:

  (lem-lsp-mode/lsp-mode::define-language-spec
      (rust-spec lem-rust-mode:rust-mode)
    :language-id "rust"
    :root-uri-patterns '("Cargo.toml")
    :command '("rust-analyzer")
    :install-command "rustup component add rust-analyzer"
    :readme-url "https://github.com/rust-lang/rust-analyzer"
    :connection-mode :stdio)

Then: ./lem --frontend webview some-rust-file.rs

The editor opens but becomes immediately unresponsive -- e.g. I see tabs but clicking them doesn't change, can't enter minibuffer, document doesn't load. Removing the define-language-spec resolves the issue.

ncurses frontend is as I said not affected.

Dominant language
Common Lisp
Stars
3.1k
Forks
261
Avg merge
1d 6h
Merged PRs (30d)
133

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lem-project/lem

All issues in lem-project/lem

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.