zed icon indicating copy to clipboard operation
zed copied to clipboard

Language servers don't work until new file is reopened

Open injust opened this issue 9 months ago • 1 comments

Summary

Steps to trigger the problem:

  1. Set up language servers for your language of choice
  2. Create a new file, type some code, and save it
  3. Do anything that triggers the language server (e.g. format on save, hover over a variable, type some bad code)
  4. Close and reopen

Actual Behavior: Zed behaves as if there is no language server configured until the file is reopened

Expected Behavior: The language server should work normally

There is no relevant output in Zed's logs or the LSP logs.

Zed Version and System Specs

Zed: v0.172.8 (Zed) OS: macOS 15.3.0 Memory: 16 GiB Architecture: x86_64

injust avatar Feb 06 '25 03:02 injust

I can reproduce. My steps:

mkdir /tmp/issue24249
cd $_
echo 'print("bar")' > bar.lua
zed . bar.lua

Click yes to install lua extension and lua-language-server. Hover over print to confirm LSP is working Close bar.lua. Quit zed Click in the edit pane and press cmd-n to create a new file type print("foo") into the buffer cmd-s and save as foo.lua

No lua-language-server (hover, etc) Close buffer (cmd-w) and reopen buffer (cmd-shift-t) Watch LSP load. Hover works.

notpeter avatar Feb 06 '25 15:02 notpeter