You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When autostart = false and any language server has been manually started, editing an existing file of a compatible file type automatically attaches the server to the new buffer, but editing a nonexistent file (with the appropriate extension such that filetype is automatically set to a compatible filetype) does not attach the server.
When autostart = true, language servers automatically attach to buffers regardless of whether the buffer is backed by an existing file.
This assumes Pyright is installed, though these steps and the provided config should be simple to adapt to any language server, as this issue is specific to nvim-lspconfig, not any language server.
touch foo.py
nvim -nu minimal_init.lua foo.py
:LspStart
:LspInfo, observe that pyright is attached to the current buffer and the workspace root is the current working directory.
:e bar.py
:LspInfo, observe that no language server is attached.
:w
:e
:LspInfo, observe that pyright is attached to the current buffer.
Actual behavior
At step 6, the language server has not attached to the newly opened buffer.
Expected behavior
Already-started language servers should automatically attach to all compatible files within their workspace, not just those that already exist.
justinmk
changed the title
Server does not automatically attach when editing nonexistent file in workspace when autostart = false
autostart=false: server does not automatically attach when editing new, nonexistent file
Oct 4, 2024
Description
When
autostart = false
and any language server has been manually started, editing an existing file of a compatible file type automatically attaches the server to the new buffer, but editing a nonexistent file (with the appropriate extension such thatfiletype
is automatically set to a compatible filetype) does not attach the server.When
autostart = true
, language servers automatically attach to buffers regardless of whether the buffer is backed by an existing file.Neovim version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3
Nvim-lspconfig version
deade69
Operating system and version
Arch Linux, up to date as of 2023-07-09
Affected language servers
all
Steps to reproduce
This assumes Pyright is installed, though these steps and the provided config should be simple to adapt to any language server, as this issue is specific to
nvim-lspconfig
, not any language server.touch foo.py
nvim -nu minimal_init.lua foo.py
:LspStart
:LspInfo
, observe thatpyright
is attached to the current buffer and the workspace root is the current working directory.:e bar.py
:LspInfo
, observe that no language server is attached.:w
:e
:LspInfo
, observe thatpyright
is attached to the current buffer.Actual behavior
At step 6, the language server has not attached to the newly opened buffer.
Expected behavior
Already-started language servers should automatically attach to all compatible files within their workspace, not just those that already exist.
Minimal config
LSP log
https://gist.github.com/Diomendius/e359bacac0b4db45f0cf0a1b1cdc26aa
The text was updated successfully, but these errors were encountered: