Open mohnasir-gh opened 5 months ago
I suspect this is not an issue of vtsls. The most probable reason for this is that the server setup like require('lspconfig').vtsls.setup({})
is called multiple times. I guess that you wrongly put it in a Filetype
autocmd, which accounts for the server restarting on file switch.
I am using LazyVim distro. I am sure I haven't put anything in autocmd. The repo I am working is a huge MonoRepo(Angular projects). When I disable angularls
lsp it seems to be working fine.
So I believe, it could be because of the memory hog or some issue with the angularls config.
Is there any other config of vtsls , that can be changed to optimized it further?
If you struggled with memory issue, take a look at https://github.com/typescript-language-server/typescript-language-server/issues/472.
Brief summary: download Node.js compiled with pointer compression from nodejs/unofficial-builds and use that to run server, if you are on Linux platform. This will cut down the memory usage by nearly half. But if your repo is really huge and the memory required is more than 4GB, this will exceed the hard limit of memory space and possibly kill the server process.
Another option you could try is to set typescript.tsserver.useSeparateSyntaxServer
to false
and typescript.tsserver.useSyntaxServer
to never
. This will ensure only one tsserver
process will be spawned instead of two.
I am not familiar with angularls
, but I could try to reproduce the problem if minimal nvim config could be provided.
Hi! Seems that I could reproduce when issue appears, but I not sure why. It appears in small nx monorepo I just started when I add new path in tsconfig. Take a look (the vtsls messages are at the bottom right):
https://github.com/yioneko/vtsls/assets/51330172/31eeaced-89e3-46b1-977a-243864eccc49
Could this be a memory issue? I use MacOS on M1 Pro chip
Minimal lazyvim repro:
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
"folke/LazyVim",
-- LazyVim default plugins
{
"LazyVim/LazyVim",
import = "lazyvim.plugins",
},
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "typescript", "tsx" })
end
end,
},
opts = {
-- make sure mason installs the server
servers = {
vtsls = {},
},
},
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"vtsls",
},
},
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
@Demianeen Thanks for your detailed information. It seems not a memory issue. Could you try to set typescript.tsserver.log
to "verbose"
and view the log at /tmp/tsserver-log-*
to see if the problem is caused by tsserver crash. Also, if tsserver crashed more than 5 times, a prompt will be shown to asking for submitting an issue to vscode (the behavior is inherited from vscode).
Okay, it seems that the issue just stopped appearing. I think it could be just some error with tsconfig at that time.
I never got the prompt from vtsls to submit the issue though
Slightly Off topic, Is it possible to not attach angular lsp to some specific file like .spec.ts
or .cy.ts
and attach in rest of the .ts
files.
Also I notice when I rename something in the .ts
file it put the rename text twice.
Hey, Thanks for this amazing plugin, I have been using it since yesterday, and the perfomance gain compare to other lsp is huge. However when I switch from one
.ts
file to other.ts
file or perform some file operations like delete etc, the LSP server seems to restart. Please find below my config from the nvim-lspconfig.Please suggest if I need to make any changes in the config