lspcontainers / lspcontainers.nvim

Neovim plugin for lspcontainers.
Apache License 2.0
308 stars 33 forks source link

gopls delay in starting #74

Closed adgai19 closed 1 year ago

adgai19 commented 2 years ago

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

ftassi commented 2 years ago

@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

adgai19 commented 2 years ago

@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.

erikreinert commented 1 year ago

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

adgai19 commented 1 year ago

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

erikreinert commented 1 year ago

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 commented 1 year ago

To be included in #92