From c679fcc10385feb9167024e7b3b201a602da53ae Mon Sep 17 00:00:00 2001 From: ecmma <48774736+ecmma@users.noreply.github.com> Date: Wed, 14 Apr 2021 22:20:58 +0200 Subject: added gopls server (#8) --- lua/nvim-lsp-installer/server.lua | 1 + lua/nvim-lsp-installer/servers/gopls.lua | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lua/nvim-lsp-installer/servers/gopls.lua (limited to 'lua') diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua index c81393c9..a2717906 100644 --- a/lua/nvim-lsp-installer/server.lua +++ b/lua/nvim-lsp-installer/server.lua @@ -7,6 +7,7 @@ local _SERVERS = { 'cssls', 'dockerls', 'eslintls', + 'gopls', 'graphql', 'html', 'jsonls', diff --git a/lua/nvim-lsp-installer/servers/gopls.lua b/lua/nvim-lsp-installer/servers/gopls.lua new file mode 100644 index 00000000..f370eded --- /dev/null +++ b/lua/nvim-lsp-installer/servers/gopls.lua @@ -0,0 +1,24 @@ +local server = require('nvim-lsp-installer.server') + +local root_dir = server.get_server_root_path('go') + +local install_cmd = [=[ + +GO111MODULE=on GOBIN="$PWD" GOPATH="$PWD" go get golang.org/x/tools/gopls@latest; +command -v ./gopls &> /dev/null; + +]=] + +return server.Server:new { + name = "gopls", + root_dir = root_dir, + pre_install_check = function () + if vim.fn.executable("go") ~= 1 then + error("Please install the Go CLI before installing gopls (https://golang.org/doc/install).") + end + end, + install_cmd = install_cmd, + default_options = { + cmd = {root_dir .. "/gopls", "-logfile=/home/ecmm/log"}, + } +} -- cgit v1.2.3-70-g09d2