Filetype: javascript
Configured backends:
lsp (supported) (attached)
treesitter (supported)
markdown (not supported) [Filetype is not markdown]
asciidoc (not supported) [Filetype is not asciidoc]
man (not supported) [Filetype is not man]
Show symbols: all symbols
Describe the bug
Maybe 9 out of 10 times, when I open a Javascript file with tsserver which gets attached lazily, all document symbols suddenly disappear and I'm left with the leaf nodes in the symbols tree, which are usually keys in objects or variables.
Lspconfig config:
{ -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
event = { 'BufReadPost', 'BufNewFile' },
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
{ 'folke/neodev.nvim', opts = {} },
},
config = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
-- local map = function(keys, func, desc)
-- vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
-- end
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
-- map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
-- map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- Opens a popup that displays documentation about the word under your cursor
-- See `:help K` for why this keymap.
-- map('K', vim.lsp.buf.hover, 'Hover Documentation')
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
callback = vim.lsp.buf.clear_references,
})
end
end,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
local servers = {
tsserver = {}, -- npm i -g typescript typescript-language-server
-- eslint = {}, -- npm i -g vscode-langservers-extracted
ember = {}, -- npm install -g @lifeart/ember-language-server
html = {}, -- npm i -g vscode-langservers-extracted
cssls = {}, -- npm i -g vscode-langservers-extracted
svelte = {}, -- npm install -g svelte-language-server
lua_ls = {},
}
require('mason').setup()
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require('mason-lspconfig').setup {
handlers = {
function(server_name)
local server = servers[server_name] or {}
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
}
end,
},
Neovim version (nvim -v)
0.9.5
Operating system/version
MacOS 14.4.1
Output of :AerialInfo
Aerial Info
Filetype: javascript Configured backends: lsp (supported) (attached) treesitter (supported) markdown (not supported) [Filetype is not markdown] asciidoc (not supported) [Filetype is not asciidoc] man (not supported) [Filetype is not man] Show symbols: all symbols
Describe the bug
Maybe 9 out of 10 times, when I open a Javascript file with tsserver which gets attached lazily, all document symbols suddenly disappear and I'm left with the leaf nodes in the symbols tree, which are usually keys in objects or variables.
Lspconfig config:
Aerial config:
What is the severity of this bug?
blocking (cannot use plugin)
Steps To Reproduce
Expected Behavior
Aerial outline should show classes and functions/methods.
Minimal example file
No response
Minimal init.lua
Additional context
No response