From a4d0ea9146c57a58cbad2e527b7992c83ddb4587 Mon Sep 17 00:00:00 2001 From: surtur Date: Thu, 10 Aug 2023 23:29:16 +0200 Subject: [PATCH] nvim: make gopls use the socket --- .config/nvim/init.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index e3321a0..b98ea54 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -487,6 +487,8 @@ require("mason").setup({ require("mason-lspconfig").setup() local lspconfig = require('lspconfig') +local util = require "lspconfig/util" + lspconfig.rnix.setup {} lspconfig.gotests.setup {} lspconfig.bashls.setup {} @@ -505,8 +507,17 @@ lspconfig.zls.setup {} lspconfig.golangci_lint.setup {} lspconfig.golangci_lint_ls.setup {} lspconfig.gopls.setup{ + cmd = {"gopls", "-remote=unix;/tmp/.gopls-daemon.sock"}, filetypes = {"go", "gomod", "gowork", "gotmpl", "gohtmltmpl"}, - options = {"-remote=unix;/tmp/.gopls-daemon.sock"} + root_dir = util.root_pattern("go.work", "go.mod", ".git"), + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + }, + }, } lspconfig.vimls.setup{} lspconfig.tailwindcss.setup{