lspcontainers.nvim icon indicating copy to clipboard operation
lspcontainers.nvim copied to clipboard

gopls delay in starting

Open adgai19 opened this issue 2 years ago • 2 comments

gopls server takes about 40 sec to connect to lsp client. The 40 seconds are from the time the gopls container starting to the first message on the logs. I haven't observed any this issue with any other clients and this issue is not present when i run the gopls binary locally. Once the server starts, it behaves normally.

My current build info

NVIM v0.8.0-dev+b9b5577d6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/adgai/github/neovim/build/config -I/home/adgai/github/neovim/src -I/home/adgai/github/neovim/.deps/usr/include -I/usr/include -I/home/adgai/github/neovim/build/src/nvim/auto -I/home/adgai/github/neovim/build/include
Compiled by root@adgai-LEGION-Y540-15IRH

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Minimal vimrc

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
	require("packer").startup({
		{
			"wbthomason/packer.nvim",
			"neovim/nvim-lspconfig",
			"lspcontainers/lspcontainers.nvim",
		},
		config = {
			package_root = package_root,
			compile_path = install_path .. "/plugin/packer_compiled.lua",
			display = { non_interactive = true },
		},
	})
end
_G.load_config = function()
	require("lspconfig").gopls.setup({
		cmd = require("lspcontainers").command("gopls"),
	})
end
if vim.fn.isdirectory(install_path) == 0 then
	print("Installing Telescope and dependencies.")
	vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]])

lsp logs

adgai19 avatar May 18 '22 06:05 adgai19

@adgai19 would you care to test my dockerfile ? I tried to fix this issue. check https://github.com/lspcontainers/dockerfiles/pull/71 out I just implemented it and have not tested extensively yet

ftassi avatar May 19 '22 07:05 ftassi

@adgai19 would you care to test my dockerfile ? I tried to fix this issue. check lspcontainers/dockerfiles#71 out I just implemented it and have not tested extensively yet

This image did fix the startup issue for me.

adgai19 avatar May 19 '22 17:05 adgai19

I recently made some changes to the gopls server - would you mind checking and seeing if this is still an issue? Thank you!

erikreinert avatar Oct 24 '22 00:10 erikreinert

unfortunately I moved to nixos a few weeks back. So I don't exactly have the same testing environment

adgai19 avatar Oct 24 '22 02:10 adgai19

Hahaha no worries - we are actually supporting Nix as a backend in V2 so that totally works. I am also a NixOS user so I understand the troubleshooting challenge. This repository DOES have a flake.nix now you are welcome to debug with if you'd like https://github.com/lspcontainers/lspcontainers.nvim/blob/main/flake.nix

This is also the current PR for Nix integration with lspcontainers: https://github.com/lspcontainers/lspcontainers.nvim/pull/91

I'll close this for now as I am getting reports of quicker start times. Thank you!

erikreinert avatar Nov 07 '22 20:11 erikreinert

To be included in #92

erikreinert avatar Nov 07 '22 20:11 erikreinert