nvim-lspconfig icon indicating copy to clipboard operation
nvim-lspconfig copied to clipboard

gopls handle go to definition in `$GOPATH/pkg/mod` of parent package

Open Snyssfx opened this issue 3 years ago • 25 comments

  • nvim --version:
NVIM v0.5.0-dev+1182-gb79596eb5
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/snyssfx/.cache/yay/neovim-git/src/build/config -I/home/snyssfx/.cache/yay/neovim-git/src/neovim-git/src -I/usr/include -I/home/snyssfx/.cache/yay/neovim-git/src/build/src/nvim/auto -I/home/snyssfx/.cache/yay/neovim-git/src/build/include
Compiled by snyssfx

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

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

Run :checkhealth for more info
  • nvim-lsp version(commit hash): 97bdebe
  • What language server (If the problem is related to a specific language server): gopls
  • Can you reproduce this behavior on other language server clients (vscode, languageclient-neovim, coc.nvim, etc.): vscode nope, coc.nvim yes
  • Can you reproduce this behavior on other language servers offered in the nvim-lspconfig repo? (pyls -> pyright): nope, since gopls is the only server for Go
  • Is the problem isolated to a particular language server: yes
  • Operating system/version:
OS: Arch Linux x86_64 
Kernel: 5.11.9-arch1-1

How to reproduce the problem from neovim startup

Jump to definition of the symbol in a submodule, which replaces its parent module in go.mod.

Actual behaviour

You cannot go to the definition of the symbols of the parent module, since neovim lsp sees go.mod in a directory, starts new server and then tries to replace parent module. But in $GOPATH/pkg/mod there is other modules hierarchy there, so gopls cannot find parent module and failes to go to definition with message:

message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error",           
title = "Error loading workspace"   

Expected behaviour

You can go to definition of the symbols of the parent module from there.

Minimal init.vim or init.lua and code sample

I use minimal_init.lua with gopls server, and created project with submodule for example here: https://github.com/Snyssfx/neovim-lspconfig-gopls-bug how to reproduce:

  • create empty directrory
  • create 2 files there: go.mod:
module github.com/Snyssfx/neovim-lspconfig-main

go 1.16

require github.com/Snyssfx/neovim-lspconfig-gopls-bug/another v0.0.0-20210328075753-65b65cceefa8 // indirect

and main.go:

package main

import (
	"github.com/Snyssfx/neovim-lspconfig-gopls-bug/another"
)

func main() {
	another.AnotherPrint()
}

then try to go to definition of AnotherPrint function and there try to go to definition of the main_package.Print().

Health check

Checkhealth result health#lspconfig#check ======================================================================== ## Checking language server protocol configuration - INFO: gopls: configuration checked.

LSP log

Log file [ START ] 2021-03-28T12:17:59+0300 ] LSP logging initiated [ INFO ] 2021-03-28T12:17:59+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ] "Starting RPC client" { args = {}, cmd = "gopls", extra = {}} [ DEBUG ] 2021-03-28T12:17:59+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:659 ] "LSP[gopls]" "initialize_params" { capabilities = { callHierarchy = { dynamicRegistration = false, = { __tostring = } }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, = }, =
}, dynamicRegistration = false, =
}, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false, =
}, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }, =
}, contextSupport = false, dynamicRegistration = false, =
}, declaration = { linkSupport = true, =
}, definition = { linkSupport = true, =
}, documentHighlight = { dynamicRegistration = false, =
}, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false, =
}, implementation = { linkSupport = true, =
}, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 }, =
}, =
}, references = { dynamicRegistration = false, =
}, rename = { dynamicRegistration = false, prepareSupport = true, =
}, signatureHelp = { dynamicRegistration = false, signatureInformation = { documentationFormat = { "markdown", "plaintext" }, =
}, =
}, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false, =
}, typeDefinition = { linkSupport = true, =
}, =
}, window = { showDocument = { support = false, =
}, showMessage = { messageActionItem = { additionalPropertiesSupport = false, =
}, =
}, workDoneProgress = true, =
}, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, workspaceEdit = { resourceOperations = { "rename", "create", "delete" }, =
}, workspaceFolders = true, =
} }, clientInfo = { name = "Neovim", version = "0.5.0" }, initializationOptions = vim.empty_dict(), processId = 41448, rootPath = "/home/snyssfx/private/neovim-lspconfig-main", rootUri = "file:///home/snyssfx/private/neovim-lspconfig-main", trace = "off", workspaceFolders = { { name = "/home/snyssfx/private/neovim-lspconfig-main", uri = "file:///home/snyssfx/private/neovim-lspconfig-main" } }} [ DEBUG ] 2021-03-28T12:17:59+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 1, jsonrpc = "2.0", method = "initialize", params = { capabilities = { callHierarchy = { dynamicRegistration = false, = { __tostring = } }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, =
}, =
}, dynamicRegistration = false, =
}, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false, =
}, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }, =
}, contextSupport = false, dynamicRegistration = false, =
}, declaration = { linkSupport = true, =
}, definition = { linkSupport = true, =
}, documentHighlight = { dynamicRegistration = false, =
}, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false, =
}, implementation = { linkSupport = true, =
}, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 }, =
}, =
}, references = { dynamicRegistration = false, =
}, rename = { dynamicRegistration = false, prepareSupport = true, =
}, signatureHelp = { dynamicRegistration = false, signatureInformation = { documentationFormat = { "markdown", "plaintext" }, =
}, =
}, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false, =
}, typeDefinition = { linkSupport = true, =
}, =
}, window = { showDocument = { support = false, =
}, showMessage = { messageActionItem = { additionalPropertiesSupport = false, =
}, =
}, workDoneProgress = true, =
}, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, workspaceEdit = { resourceOperations = { "rename", "create", "delete" }, =
}, workspaceFolders = true, =
} }, clientInfo = { name = "Neovim", version = "0.5.0" }, initializationOptions = vim.empty_dict(), processId = 41448, rootPath = "/home/snyssfx/private/neovim-lspconfig-main", rootUri = "file:///home/snyssfx/private/neovim-lspconfig-main", trace = "off", workspaceFolders = { { name = "/home/snyssfx/private/neovim-lspconfig-main", uri = "file:///home/snyssfx/private/neovim-lspconfig-main" } } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 1, jsonrpc = "2.0", result = { capabilities = { callHierarchyProvider = true, codeActionProvider = { codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" } }, codeLensProvider = vim.empty_dict(), completionProvider = { triggerCharacters = { "." } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentLinkProvider = vim.empty_dict(), documentOnTypeFormattingProvider = { firstTriggerCharacter = "" }, documentSymbolProvider = true, executeCommandProvider = { commands = { "gopls.generate", "gopls.fill_struct", "gopls.regenerate_cgo", "gopls.test", "gopls.tidy", "gopls.update_go_sum", "gopls.undeclared_name", "gopls.go_get_package", "gopls.add_dependency", "gopls.upgrade_dependency", "gopls.remove_dependency", "gopls.vendor", "gopls.extract_variable", "gopls.extract_function", "gopls.gc_details", "gopls.generate_gopls_mod" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = { prepareProvider = true }, signatureHelpProvider = { triggerCharacters = { "(", "," } }, textDocumentSync = { change = 2, openClose = true, save = vim.empty_dict() }, typeDefinitionProvider = true, workspace = { workspaceFolders = { changeNotifications = "workspace/didChangeWorkspaceFolders", supported = true } }, workspaceSymbolProvider = true }, serverInfo = { name = "gopls", version = '{"path":"golang.org/x/tools/gopls","version":"(devel)","deps":[{"path":"github.com/BurntSushi/toml","version":"v0.3.1","sum":"h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ="},{"path":"github.com/google/go-cmp","version":"v0.5.4","sum":"h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M="},{"path":"github.com/sergi/go-diff","version":"v1.1.0","sum":"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0="},{"path":"golang.org/x/mod","version":"v0.4.0","sum":"h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8="},{"path":"golang.org/x/sync","version":"v0.0.0-20201020160332-67f06af15bc9","sum":"h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck="},{"path":"golang.org/x/sys","version":"v0.0.0-20210119212857-b64e53b001e4","sum":"h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k="},{"path":"golang.org/x/tools","version":"v0.1.1-0.20210119222907-0a1a9685734a","sum":"h1:ttr/sghFptib3jlHwNS65KwGoqjr03TFzso3kpHyia8="},{"path":"golang.org/x/xerrors","version":"v0.0.0-20200804184101-5ec99f83aff1","sum":"h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE="},{"path":"honnef.co/go/tools","version":"v0.0.1-2020.1.6","sum":"h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc="},{"path":"mvdan.cc/gofumpt","version":"v0.1.0","sum":"h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw="},{"path":"mvdan.cc/xurls/v2","version":"v2.2.0","sum":"h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A="}]}' } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "initialized", params = { [true] = 6 }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:686 ] "LSP[gopls]" "server_capabilities" { callHierarchyProvider = true, codeActionProvider = { codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" } }, codeLensProvider = {}, completionProvider = { triggerCharacters = { "." } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentLinkProvider = {}, documentOnTypeFormattingProvider = { firstTriggerCharacter = "" }, documentSymbolProvider = true, executeCommandProvider = { commands = { "gopls.generate", "gopls.fill_struct", "gopls.regenerate_cgo", "gopls.test", "gopls.tidy", "gopls.update_go_sum", "gopls.undeclared_name", "gopls.go_get_package", "gopls.add_dependency", "gopls.upgrade_dependency", "gopls.remove_dependency", "gopls.vendor", "gopls.extract_variable", "gopls.extract_function", "gopls.gc_details", "gopls.generate_gopls_mod" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = { prepareProvider = true }, signatureHelpProvider = { triggerCharacters = { "(", "," } }, textDocumentSync = { change = 2, openClose = true, save = {} }, typeDefinitionProvider = true, workspace = { workspaceFolders = { changeNotifications = "workspace/didChangeWorkspaceFolders", supported = true } }, workspaceSymbolProvider = true} [ INFO ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:687 ] "LSP[gopls]" "initialized" { resolved_capabilities = { call_hierarchy = true, code_action = { codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" } }, code_lens = true, code_lens_resolve = false, completion = true, declaration = false, document_formatting = true, document_highlight = true, document_range_formatting = false, document_symbol = true, execute_command = true, find_references = true, goto_definition = true, hover = true, implementation = true, rename = true, signature_help = true, signature_help_trigger_characters = { "(", "," }, text_document_did_change = 2, text_document_open_close = true, text_document_save = {}, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = true, workspace_folder_properties = { changeNotifications = "workspace/didChangeWorkspaceFolders", supported = true }, workspace_symbol = true }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "go", text = 'package main\n\nimport (\n\t"github.com/Snyssfx/neovim-lspconfig-gopls-bug/another"\n)\n\nfunc main() {\n\tanother.AnotherPrint()\n}\n', uri = "file:///home/snyssfx/private/neovim-lspconfig-main/main.go", version = 0 } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "textDocument/publishDiagnostics" { client_id = 1, params = { diagnostics = {}, uri = "file:///home/snyssfx/private/neovim-lspconfig-main/main.go" }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 1, jsonrpc = "2.0", method = "window/workDoneProgress/create", params = { token = "5577006791947779410" }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:527 ] "server_request" "window/workDoneProgress/create" { token = "5577006791947779410"} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:530 ] "server_request: found handler for" "window/workDoneProgress/create" [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/workDoneProgress/create" { client_id = 1, params = { token = "5577006791947779410" }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:503 ] "server_request: callback result" { result = vim.NIL, status = true} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 1, jsonrpc = "2.0", result = vim.NIL} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "$/progress", params = { token = "5577006791947779410", value = { kind = "begin", message = "Loading packages...", title = "Setting up workspace" } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "$/progress" { token = "5577006791947779410", value = { kind = "begin", message = "Loading packages...", title = "Setting up workspace" }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "$/progress" { client_id = 1, params = { token = "5577006791947779410", value = { kind = "begin", message = "Loading packages...", title = "Setting up workspace" } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 2, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "file:///home/snyssfx/private/neovim-lspconfig-main", section = "gopls" } } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:527 ] "server_request" "workspace/configuration" { items = { { scopeUri = "file:///home/snyssfx/private/neovim-lspconfig-main", section = "gopls" } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:530 ] "server_request: found handler for" "workspace/configuration" [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "workspace/configuration" { client_id = 1, params = { items = { { scopeUri = "file:///home/snyssfx/private/neovim-lspconfig-main", section = "gopls" } } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:503 ] "server_request: callback result" { result = { vim.NIL }, status = true} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 2, jsonrpc = "2.0", result = { vim.NIL }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:02 go env for /home/snyssfx/private/neovim-lspconfig-main\n(root /home/snyssfx/private/neovim-lspconfig-main)\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGONOSUMDB=\nGOPATH=/home/snyssfx/go\nGOPRIVATE=\nGOROOT=/usr/lib/go\nGONOPROXY=\nGOFLAGS=\nGOINSECURE=\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGOPROXY=https://proxy.golang.org,direct\nGOSUMDB=sum.golang.org\nGO111MODULE=\nGOMOD=/home/snyssfx/private/neovim-lspconfig-main/go.mod\nGOCACHE=/home/snyssfx/.cache/go-build\n\n", type = 3 }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:02 go env for /home/snyssfx/private/neovim-lspconfig-main\n(root /home/snyssfx/private/neovim-lspconfig-main)\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGONOSUMDB=\nGOPATH=/home/snyssfx/go\nGOPRIVATE=\nGOROOT=/usr/lib/go\nGONOPROXY=\nGOFLAGS=\nGOINSECURE=\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGOPROXY=https://proxy.golang.org,direct\nGOSUMDB=sum.golang.org\nGO111MODULE=\nGOMOD=/home/snyssfx/private/neovim-lspconfig-main/go.mod\nGOCACHE=/home/snyssfx/.cache/go-build\n\n", type = 3} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 1, params = { message = "2021/03/28 12:18:02 go env for /home/snyssfx/private/neovim-lspconfig-main\n(root /home/snyssfx/private/neovim-lspconfig-main)\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGONOSUMDB=\nGOPATH=/home/snyssfx/go\nGOPRIVATE=\nGOROOT=/usr/lib/go\nGONOPROXY=\nGOFLAGS=\nGOINSECURE=\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGOPROXY=https://proxy.golang.org,direct\nGOSUMDB=sum.golang.org\nGO111MODULE=\nGOMOD=/home/snyssfx/private/neovim-lspconfig-main/go.mod\nGOCACHE=/home/snyssfx/.cache/go-build\n\n", type = 3 }} [ INFO ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ] "2021/03/28 12:18:02 go env for /home/snyssfx/private/neovim-lspconfig-main\n(root /home/snyssfx/private/neovim-lspconfig-main)\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGONOSUMDB=\nGOPATH=/home/snyssfx/go\nGOPRIVATE=\nGOROOT=/usr/lib/go\nGONOPROXY=\nGOFLAGS=\nGOINSECURE=\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGOPROXY=https://proxy.golang.org,direct\nGOSUMDB=sum.golang.org\nGO111MODULE=\nGOMOD=/home/snyssfx/private/neovim-lspconfig-main/go.mod\nGOCACHE=/home/snyssfx/.cache/go-build\n\n" [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:02 go/packages.Load\n\tsnapshot=0\n\tdirectory=/home/snyssfx/private/neovim-lspconfig-main\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-main/...]\n\tpackages=2\n", type = 3 }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:02 go/packages.Load\n\tsnapshot=0\n\tdirectory=/home/snyssfx/private/neovim-lspconfig-main\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-main/...]\n\tpackages=2\n", type = 3} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 1, params = { message = "2021/03/28 12:18:02 go/packages.Load\n\tsnapshot=0\n\tdirectory=/home/snyssfx/private/neovim-lspconfig-main\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-main/...]\n\tpackages=2\n", type = 3 }} [ INFO ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ] "2021/03/28 12:18:02 go/packages.Load\n\tsnapshot=0\n\tdirectory=/home/snyssfx/private/neovim-lspconfig-main\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-main/...]\n\tpackages=2\n" [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "$/progress", params = { token = "5577006791947779410", value = { kind = "end", message = "Finished loading packages." } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "$/progress" { token = "5577006791947779410", value = { kind = "end", message = "Finished loading packages." }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "$/progress" { client_id = 1, params = { token = "5577006791947779410", value = { kind = "end", message = "Finished loading packages." } }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = { { message = "github.com/Snyssfx/neovim-lspconfig-gopls-bug/another should be direct", range = { end = { character = 108, line = 4 }, start = { character = 97, line = 4 } }, severity = 2, source = "go mod tidy" } }, uri = "file:///home/snyssfx/private/neovim-lspconfig-main/go.mod" }} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "textDocument/publishDiagnostics" { diagnostics = { { message = "github.com/Snyssfx/neovim-lspconfig-gopls-bug/another should be direct", range = { end = { character = 108, line = 4 }, start = { character = 97, line = 4 } }, severity = 2, source = "go mod tidy" } }, uri = "file:///home/snyssfx/private/neovim-lspconfig-main/go.mod"} [ DEBUG ] 2021-03-28T12:18:02+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "textDocument/publishDiagnostics" { client_id = 1, params = { diagnostics = { { message = "github.com/Snyssfx/neovim-lspconfig-gopls-bug/another should be direct", range = { end = { character = 108, line = 4 }, start = { character = 97, line = 4 } }, severity = 2, source = "go mod tidy" } }, uri = "file:///home/snyssfx/private/neovim-lspconfig-main/go.mod" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:724 ] "LSP[gopls]" "client.request" 1 "textDocument/definition" { position = { character = 16, line = 7 }, textDocument = { uri = "file:///home/snyssfx/private/neovim-lspconfig-main/main.go" }} 1 [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 2, jsonrpc = "2.0", method = "textDocument/definition", params = { position = { character = 16, line = 7 }, textDocument = { uri = "file:///home/snyssfx/private/neovim-lspconfig-main/main.go" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 2, jsonrpc = "2.0", result = { { range = { end = { character = 17, line = 6 }, start = { character = 5, line = 6 } }, uri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "textDocument/definition" { bufnr = 1, client_id = 1, params = { { range = { end = { character = 17, line = 6 }, start = { character = 5, line = 6 } }, uri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didClose", params = { textDocument = { uri = "file:///home/snyssfx/private/neovim-lspconfig-main/main.go" } }} [ INFO ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ] "Starting RPC client" { args = {}, cmd = "gopls", extra = {}} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:659 ] "LSP[gopls]" "initialize_params" { capabilities = { callHierarchy = { dynamicRegistration = false, = { __tostring = } }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, =
}, =
}, dynamicRegistration = false, =
}, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false, =
}, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }, =
}, contextSupport = false, dynamicRegistration = false, =
}, declaration = { linkSupport = true, =
}, definition = { linkSupport = true, =
}, documentHighlight = { dynamicRegistration = false, =
}, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false, =
}, implementation = { linkSupport = true, =
}, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 }, =
}, =
}, references = { dynamicRegistration = false, =
}, rename = { dynamicRegistration = false, prepareSupport = true, =
}, signatureHelp = { dynamicRegistration = false, signatureInformation = { documentationFormat = { "markdown", "plaintext" }, =
}, =
}, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false, =
}, typeDefinition = { linkSupport = true, =
}, =
}, window = { showDocument = { support = false, =
}, showMessage = { messageActionItem = { additionalPropertiesSupport = false, =
}, =
}, workDoneProgress = true, =
}, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, workspaceEdit = { resourceOperations = { "rename", "create", "delete" }, =
}, workspaceFolders = true, =
} }, clientInfo = { name = "Neovim", version = "0.5.0" }, initializationOptions = vim.empty_dict(), processId = 41448, rootPath = "/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]", rootUri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]", trace = "off", workspaceFolders = { { name = "/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]", uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 1, jsonrpc = "2.0", method = "initialize", params = { capabilities = { callHierarchy = { dynamicRegistration = false, = { __tostring = } }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, =
}, =
}, dynamicRegistration = false, =
}, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false, =
}, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }, =
}, contextSupport = false, dynamicRegistration = false, =
}, declaration = { linkSupport = true, =
}, definition = { linkSupport = true, =
}, documentHighlight = { dynamicRegistration = false, =
}, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = false, =
}, implementation = { linkSupport = true, =
}, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 }, =
}, =
}, references = { dynamicRegistration = false, =
}, rename = { dynamicRegistration = false, prepareSupport = true, =
}, signatureHelp = { dynamicRegistration = false, signatureInformation = { documentationFormat = { "markdown", "plaintext" }, =
}, =
}, synchronization = { didSave = true, dynamicRegistration = false, willSave = false, willSaveWaitUntil = false, =
}, typeDefinition = { linkSupport = true, =
}, =
}, window = { showDocument = { support = false, =
}, showMessage = { messageActionItem = { additionalPropertiesSupport = false, =
}, =
}, workDoneProgress = true, =
}, workspace = { applyEdit = true, configuration = true, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }, =
}, =
}, workspaceEdit = { resourceOperations = { "rename", "create", "delete" }, =
}, workspaceFolders = true, =
} }, clientInfo = { name = "Neovim", version = "0.5.0" }, initializationOptions = vim.empty_dict(), processId = 41448, rootPath = "/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]", rootUri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]", trace = "off", workspaceFolders = { { name = "/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]", uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]" } } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 1, jsonrpc = "2.0", result = { capabilities = { callHierarchyProvider = true, codeActionProvider = { codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" } }, codeLensProvider = vim.empty_dict(), completionProvider = { triggerCharacters = { "." } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentLinkProvider = vim.empty_dict(), documentOnTypeFormattingProvider = { firstTriggerCharacter = "" }, documentSymbolProvider = true, executeCommandProvider = { commands = { "gopls.generate", "gopls.fill_struct", "gopls.regenerate_cgo", "gopls.test", "gopls.tidy", "gopls.update_go_sum", "gopls.undeclared_name", "gopls.go_get_package", "gopls.add_dependency", "gopls.upgrade_dependency", "gopls.remove_dependency", "gopls.vendor", "gopls.extract_variable", "gopls.extract_function", "gopls.gc_details", "gopls.generate_gopls_mod" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = { prepareProvider = true }, signatureHelpProvider = { triggerCharacters = { "(", "," } }, textDocumentSync = { change = 2, openClose = true, save = vim.empty_dict() }, typeDefinitionProvider = true, workspace = { workspaceFolders = { changeNotifications = "workspace/didChangeWorkspaceFolders", supported = true } }, workspaceSymbolProvider = true }, serverInfo = { name = "gopls", version = '{"path":"golang.org/x/tools/gopls","version":"(devel)","deps":[{"path":"github.com/BurntSushi/toml","version":"v0.3.1","sum":"h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ="},{"path":"github.com/google/go-cmp","version":"v0.5.4","sum":"h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M="},{"path":"github.com/sergi/go-diff","version":"v1.1.0","sum":"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0="},{"path":"golang.org/x/mod","version":"v0.4.0","sum":"h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8="},{"path":"golang.org/x/sync","version":"v0.0.0-20201020160332-67f06af15bc9","sum":"h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck="},{"path":"golang.org/x/sys","version":"v0.0.0-20210119212857-b64e53b001e4","sum":"h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k="},{"path":"golang.org/x/tools","version":"v0.1.1-0.20210119222907-0a1a9685734a","sum":"h1:ttr/sghFptib3jlHwNS65KwGoqjr03TFzso3kpHyia8="},{"path":"golang.org/x/xerrors","version":"v0.0.0-20200804184101-5ec99f83aff1","sum":"h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE="},{"path":"honnef.co/go/tools","version":"v0.0.1-2020.1.6","sum":"h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc="},{"path":"mvdan.cc/gofumpt","version":"v0.1.0","sum":"h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw="},{"path":"mvdan.cc/xurls/v2","version":"v2.2.0","sum":"h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A="}]}' } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "initialized", params = { [true] = 6 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:686 ] "LSP[gopls]" "server_capabilities" { callHierarchyProvider = true, codeActionProvider = { codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" } }, codeLensProvider = {}, completionProvider = { triggerCharacters = { "." } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentLinkProvider = {}, documentOnTypeFormattingProvider = { firstTriggerCharacter = "" }, documentSymbolProvider = true, executeCommandProvider = { commands = { "gopls.generate", "gopls.fill_struct", "gopls.regenerate_cgo", "gopls.test", "gopls.tidy", "gopls.update_go_sum", "gopls.undeclared_name", "gopls.go_get_package", "gopls.add_dependency", "gopls.upgrade_dependency", "gopls.remove_dependency", "gopls.vendor", "gopls.extract_variable", "gopls.extract_function", "gopls.gc_details", "gopls.generate_gopls_mod" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = { prepareProvider = true }, signatureHelpProvider = { triggerCharacters = { "(", "," } }, textDocumentSync = { change = 2, openClose = true, save = {} }, typeDefinitionProvider = true, workspace = { workspaceFolders = { changeNotifications = "workspace/didChangeWorkspaceFolders", supported = true } }, workspaceSymbolProvider = true} [ INFO ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:687 ] "LSP[gopls]" "initialized" { resolved_capabilities = { call_hierarchy = true, code_action = { codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" } }, code_lens = true, code_lens_resolve = false, completion = true, declaration = false, document_formatting = true, document_highlight = true, document_range_formatting = false, document_symbol = true, execute_command = true, find_references = true, goto_definition = true, hover = true, implementation = true, rename = true, signature_help = true, signature_help_trigger_characters = { "(", "," }, text_document_did_change = 2, text_document_open_close = true, text_document_save = {}, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = true, workspace_folder_properties = { changeNotifications = "workspace/didChangeWorkspaceFolders", supported = true }, workspace_symbol = true }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "go", text = 'package another\n\nimport (\n\tmain_package "github.com/Snyssfx/neovim-lspconfig-gopls-bug"\n)\n\nfunc AnotherPrint() {\n\tprintln("in another package")\n\tmain_package.Print()\n}\n', uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go", version = 0 } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "textDocument/publishDiagnostics" { client_id = 2, params = { diagnostics = {}, uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 1, jsonrpc = "2.0", method = "window/workDoneProgress/create", params = { token = "5577006791947779410" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:527 ] "server_request" "window/workDoneProgress/create" { token = "5577006791947779410"} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:530 ] "server_request: found handler for" "window/workDoneProgress/create" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/workDoneProgress/create" { client_id = 2, params = { token = "5577006791947779410" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:503 ] "server_request: callback result" { result = vim.NIL, status = true} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 1, jsonrpc = "2.0", result = vim.NIL} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "$/progress", params = { token = "5577006791947779410", value = { kind = "begin", message = "Loading packages...", title = "Setting up workspace" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "$/progress" { token = "5577006791947779410", value = { kind = "begin", message = "Loading packages...", title = "Setting up workspace" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "$/progress" { client_id = 2, params = { token = "5577006791947779410", value = { kind = "begin", message = "Loading packages...", title = "Setting up workspace" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 2, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { scopeUri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]", section = "gopls" } } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:527 ] "server_request" "workspace/configuration" { items = { { scopeUri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]", section = "gopls" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:530 ] "server_request: found handler for" "workspace/configuration" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "workspace/configuration" { client_id = 2, params = { items = { { scopeUri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]", section = "gopls" } } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:503 ] "server_request: callback result" { result = { vim.NIL }, status = true} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 2, jsonrpc = "2.0", result = { vim.NIL }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:04 go env for /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n(root /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected])\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOROOT=/usr/lib/go\nGOCACHE=/home/snyssfx/.cache/go-build\nGOFLAGS=\nGONOPROXY=\nGOSUMDB=sum.golang.org\nGOMOD=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod\nGOPATH=/home/snyssfx/go\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGONOSUMDB=\nGOPRIVATE=\nGOPROXY=https://proxy.golang.org,direct\nGO111MODULE=\nGOINSECURE=\n\n", type = 3 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:04 go env for /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n(root /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected])\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOROOT=/usr/lib/go\nGOCACHE=/home/snyssfx/.cache/go-build\nGOFLAGS=\nGONOPROXY=\nGOSUMDB=sum.golang.org\nGOMOD=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod\nGOPATH=/home/snyssfx/go\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGONOSUMDB=\nGOPRIVATE=\nGOPROXY=https://proxy.golang.org,direct\nGO111MODULE=\nGOINSECURE=\n\n", type = 3} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:04 go env for /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n(root /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected])\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOROOT=/usr/lib/go\nGOCACHE=/home/snyssfx/.cache/go-build\nGOFLAGS=\nGONOPROXY=\nGOSUMDB=sum.golang.org\nGOMOD=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod\nGOPATH=/home/snyssfx/go\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGONOSUMDB=\nGOPRIVATE=\nGOPROXY=https://proxy.golang.org,direct\nGO111MODULE=\nGOINSECURE=\n\n", type = 3 }} [ INFO ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ] "2021/03/28 12:18:04 go env for /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n(root /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected])\n(go version go version go1.16.2 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOROOT=/usr/lib/go\nGOCACHE=/home/snyssfx/.cache/go-build\nGOFLAGS=\nGONOPROXY=\nGOSUMDB=sum.golang.org\nGOMOD=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod\nGOPATH=/home/snyssfx/go\nGOMODCACHE=/home/snyssfx/go/pkg/mod\nGONOSUMDB=\nGOPRIVATE=\nGOPROXY=https://proxy.golang.org,direct\nGO111MODULE=\nGOINSECURE=\n\n" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:04 creating workspace dir: mkdir /tmp/gopls-41448.workspace: file exists\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:04 creating workspace dir: mkdir /tmp/gopls-41448.workspace: file exists\n", type = 1} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:04 creating workspace dir: mkdir /tmp/gopls-41448.workspace: file exists\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:04 creating workspace dir: mkdir /tmp/gopls-41448.workspace: file exists\n" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:04 initial workspace load failed: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=0\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-gopls-bug/another/...]\n\tpackages=0\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "$/progress", params = { token = "5577006791947779410", value = { kind = "end", message = "Finished loading packages." } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:04 initial workspace load failed: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n", type = 1} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:04 initial workspace load failed: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:04 initial workspace load failed: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:04 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=0\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-gopls-bug/another/...]\n\tpackages=0\n", type = 1} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=0\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-gopls-bug/another/...]\n\tpackages=0\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=0\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[builtin github.com/Snyssfx/neovim-lspconfig-gopls-bug/another/...]\n\tpackages=0\n" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 3, jsonrpc = "2.0", method = "window/workDoneProgress/create", params = { token = "8674665223082153551" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "$/progress" { token = "5577006791947779410", value = { kind = "end", message = "Finished loading packages." }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "$/progress" { client_id = 2, params = { token = "5577006791947779410", value = { kind = "end", message = "Finished loading packages." } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:04 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n", type = 1} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:04 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:04 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:527 ] "server_request" "window/workDoneProgress/create" { token = "8674665223082153551"} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:530 ] "server_request: found handler for" "window/workDoneProgress/create" [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/workDoneProgress/create" { client_id = 2, params = { token = "8674665223082153551" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:503 ] "server_request: callback result" { result = vim.NIL, status = true} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 3, jsonrpc = "2.0", result = vim.NIL} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "$/progress", params = { token = "8674665223082153551", value = { kind = "begin", message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error", title = "Error loading workspace" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "$/progress" { token = "8674665223082153551", value = { kind = "begin", message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error", title = "Error loading workspace" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "$/progress" { client_id = 2, params = { token = "8674665223082153551", value = { kind = "begin", message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error", title = "Error loading workspace" } }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "textDocument/publishDiagnostics", params = { diagnostics = { { message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error", range = { end = { character = 88, line = 4 }, start = { character = 0, line = 4 } }, severity = 1 } }, uri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "textDocument/publishDiagnostics" { diagnostics = { { message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error", range = { end = { character = 88, line = 4 }, start = { character = 0, line = 4 } }, severity = 1 } }, uri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod"} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "textDocument/publishDiagnostics" { client_id = 2, params = { diagnostics = { { message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error", range = { end = { character = 88, line = 4 }, start = { character = 0, line = 4 } }, severity = 1 } }, uri = "file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/go.mod" }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1} [ DEBUG ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:04+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:04 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n" [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:05 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:05 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:05 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:05 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n" [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:05 reloadOrphanedFiles: failed to load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tquery=[file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "$/progress", params = { token = "8674665223082153551", value = { kind = "report", message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error" } }} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:05 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=1\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:05 reloadOrphanedFiles: failed to load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tquery=[file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n", type = 1} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:05 reloadOrphanedFiles: failed to load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tquery=[file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:05 reloadOrphanedFiles: failed to load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tquery=[file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n" [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "$/progress" { token = "8674665223082153551", value = { kind = "report", message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error" }} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "$/progress" { client_id = 2, params = { token = "8674665223082153551", value = { kind = "report", message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory : packages.Load error" } }} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:05 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=1\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n", type = 1} [ DEBUG ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:05 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=1\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:05+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:05 errors loading workspace: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error\n\tsnapshot=1\n\tdirectory=file:///home/snyssfx/go/pkg/mod/github.com/%21snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n" [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:724 ] "LSP[gopls]" "client.request" 2 "textDocument/definition" { position = { character = 14, line = 8 }, textDocument = { uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" }} 3 [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 2, jsonrpc = "2.0", method = "textDocument/definition", params = { position = { character = 14, line = 8 }, textDocument = { uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" } }} [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { error = { code = 0, message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error" }, id = 2, jsonrpc = "2.0"} [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:06 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:06 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1} [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:06 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:06 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n" [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:724 ] "LSP[gopls]" "client.request" 2 "textDocument/definition" { position = { character = 14, line = 8 }, textDocument = { uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" }} 3 [ DEBUG ] 2021-03-28T12:18:06+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { id = 3, jsonrpc = "2.0", method = "textDocument/definition", params = { position = { character = 14, line = 8 }, textDocument = { uri = "file:///home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go" } }} [ DEBUG ] 2021-03-28T12:18:07+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { error = { code = 0, message = "err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n: packages.Load error" }, id = 3, jsonrpc = "2.0"} [ DEBUG ] 2021-03-28T12:18:07+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { jsonrpc = "2.0", method = "window/logMessage", params = { message = "2021/03/28 12:18:07 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ DEBUG ] 2021-03-28T12:18:07+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:513 ] "notification" "window/logMessage" { message = "2021/03/28 12:18:07 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1} [ DEBUG ] 2021-03-28T12:18:07+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:409 ] "default_handler" "window/logMessage" { client_id = 2, params = { message = "2021/03/28 12:18:07 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n", type = 1 }} [ ERROR ] 2021-03-28T12:18:07+0300 ] /usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:377 ] "2021/03/28 12:18:07 go/packages.Load: err: exit status 1: stderr: go: github.com/Snyssfx/[email protected] (replaced by ./..): reading ../go.mod: open /home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/go.mod: no such file or directory\n\n\tsnapshot=1\n\tdirectory=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]\n\tquery=[file=/home/snyssfx/go/pkg/mod/github.com/!snyssfx/neovim-lspconfig-gopls-bug/[email protected]/another.go]\n\tpackages=0\n" [ INFO ] 2021-03-28T12:18:08+0300 ] /usr/share/nvim/runtime/lua/vim/lsp.lua:1040 ] "exit_handler" { { _cached_buffers = {}, _on_attach = , cancel_request = , config = { _on_attach = , capabilities = { callHierarchy = { dynamicRegistration = false,

Snyssfx avatar Mar 28 '21 09:03 Snyssfx

How I resolve this problem in my init.lua:

local util = require('lspconfig/util')
local lastRootPath = nil
local gopath = os.getenv("GOPATH")
if gopath == nil then
  gopath = ""
end
local gopathmod = gopath..'/pkg/mod'

nvim_lsp.gopls.setup {
  root_dir = function(fname)
    local fullpath = vim.fn.expand(fname, ':p')
    if string.find(fullpath, gopathmod) and lastRootPath ~= nil then
        return lastRootPath
    end
    lastRootPath = util.root_pattern("go.mod", ".git")(fname)
    return lastRootPath
  end,
  }

Basically what I try to achieve is to attach to the previous gopls instance when I go to the $GOPATH/pkg/mod dir. Should I create PR or may be write this behaviour in the documentation of the neovim-lspconfig?

Snyssfx avatar Mar 28 '21 09:03 Snyssfx

If I'm understanding you correctly, you want to not start a new language server, but attach to the active language server, when navigating to system go packages?

mjlbach avatar Mar 28 '21 17:03 mjlbach

@mjlbach yes)

Snyssfx avatar Mar 28 '21 17:03 Snyssfx

I'm not sure how I feel about having it match root directory to GOPATH. I think the better solution is to interactively prompt the user if they would like to attach a new root to the current server when first navigating to a new project (I think this is what vscode does).

mjlbach avatar Mar 28 '21 17:03 mjlbach

Yes, I try to achieve the same result: if the user goes to the /pkg/mod dir, it should be attached to the previous server instance. Otherwise the new server won't be able to resolve the dependency of the parent module.

Should it prompt the user different options or be attached silently? It might be bothering if the prompt appears many times because of, for example, nvim restarting

Snyssfx avatar Mar 28 '21 18:03 Snyssfx

TBH I'm not really sure the best way to handle this from a UX perspective. On one hand, you may not want the language server to automatically start indexing the go standard library, on the other hand, multiple prompts are annoying.

mjlbach avatar Mar 28 '21 22:03 mjlbach

By the way I believe vscode choose to attach the pkg/mod silently as well as Goland allows you to jump to definitions in modules, although it doesn't use the language server. So it looks like a non-obvious behavior for me. May be it should be documented somewhere.

Snyssfx avatar Mar 29 '21 06:03 Snyssfx

@Snyssfx sorry, I kinda put this on the backburner. I think for now, we can merge a fix similar to yours (put as much of the state in the root_dir function as possible) that's unique to go. I want to fix this more generally in the long-term, but I think for now this is fine and probably solves some usability issues. If you have the time, please file a PR.

mjlbach avatar May 01 '21 18:05 mjlbach

@mjlbach ok, I will make the PR then)

Snyssfx avatar May 03 '21 08:05 Snyssfx

How I resolve this problem in my init.lua:

local util = require('lspconfig/util')
local lastRootPath = nil
local gopath = os.getenv("GOPATH")
if gopath == nil then
  gopath = ""
end
local gopathmod = gopath..'/pkg/mod'

nvim_lsp.gopls.setup {
  root_dir = function(fname)
    local fullpath = vim.fn.expand(fname, ':p')
    if string.find(fullpath, gopathmod) and lastRootPath ~= nil then
        return lastRootPath
    end
    lastRootPath = util.root_pattern("go.mod", ".git")(fname)
    return lastRootPath
  end,
  }

Basically what I try to achieve is to attach to the previous gopls instance when I go to the $GOPATH/pkg/mod dir. Should I create PR or may be write this behaviour in the documentation of the neovim-lspconfig?

well, I have to say, you help me a lot. I was confused how to keep root folder if sub repo do not have a go.mod file,(gopls would not work in default). Hope this feature can merge into master, or basically, have a document also could be fine

seraph98 avatar Oct 30 '21 08:10 seraph98

Sorry, I procrastinated on this one (partly because I still don't understand the gomodule system).

Since gopath seems to be deprecated in favor of go modules? I tried a different route. LMK what you think: https://github.com/neovim/nvim-lspconfig/pull/1399

mjlbach avatar Nov 11 '21 08:11 mjlbach

@mjlbach hi! I also know a little about go.work feature, as I see, it can remove necessity of replace statements in go.mod and therefore necessity of this issue.

But still there will be old codebases with replace statements because of Go backward compatibility with old versions, so this case won't be solved.

The problem occurs when there is a module in $GOPATH/pkg/mod (I believe the directory contains all cached modules from go.mod file) with replace statement. VScode treats the project's root go.mod as a source of truth, but the default lsp-config configuration rather choose $GOPATH/pkg/mod one. And then the lsp server is created, and can't follow the replaced expression since $GOPATH/pkg/mod has flat dir hierarchy.

Snyssfx avatar Nov 12 '21 14:11 Snyssfx

It is the real case from my work, so I would suggest to reopen the issue)

Snyssfx avatar Nov 12 '21 14:11 Snyssfx

@Snyssfx I closed the issue only because I fixed it via #1399

It wasn't go.work I added, but rather traversing up the filesystem hierarchy and picking the top level go.mod.

I had to temporarily revert my PR due to an issue that was filed (which doesn't automatically reopen the issue), but someone unreverted my commit in https://github.com/neovim/nvim-lspconfig/pull/1411 which you can test.

mjlbach avatar Nov 12 '21 15:11 mjlbach

@mjlbach oh, I see, as far as I understand traversing up the filesystem solves slightly different case.

Consider an example where someone work at the project not in $GOPATH, for example, in ~/project. Then one tries to go to definition in the library which defined in ~/project/go.mod.

The library has go.mod itself, and it physically located in $GOPATH/pkg/mod/library/go.mod (go command download libraries there). The library also has replace expression in the $GOPATH/pkg/mod/library/go.mod, which replaces some module for development reasons.

The developer of the library forgot to delete replace (as I learned today it's considered as a bad practice), and as soon as one open up the buffer with the library code, lspconfig will create new gopls instance. It won't be able to go to definition of whatever in replace statement. Assuming that usually $GOPATH is ~/go, traversing up from ~/go/pkg/mod/library cannot find ~/project/go.mod, so it creates new server instead of attach to the old one.

On the other hand, your fix is pretty important too, since it will handle the popular way of treating replaces that contains in ~/project/go.mod itself :)

Snyssfx avatar Nov 12 '21 17:11 Snyssfx

(Sorry, still operating with a layman's understanding of the go module system, the following is kinda a braindup for my future use)

My understanding is GOPATH was slated to be deprecated in go 1.17 but this was deferred until 1.18. My fix should cover common scenarios for older projects, but not in scenarios where GOPATH includes library directories not in the project as you pointed out.

The problem is that using root_directory to include all files under gopath is sorta "misusing" (I say this lightly, because yours is a valid usecase) what a rootDirectory/workspaceFolder is supposed to be according to the LSP spec. A rootDirectory is communicated to the server via initialization options as "this is the root of the project, you should index everything under this folder and ignore everything else" but also used internally by lspconfig as "attach a buffer to the language server instance if it meets this pattern, otherwise start a new language server and attach the buffer". With the current workaround, it's essentially adding logic within root_dir

With the proposed GOPATH change, the buffer will be attached to the actively running language server (good), but will this buffer may or may not point to a file which is under the server side rootDirectory/workspaceFolders which is bad (I'm not sure navigation/code analysis will work outside of the single attached buffer which lives outside the rootDirectory that has been communicated to the language server.

The only solution I can really think of that solves this is to either override the location handlers to take a client_id in the ctx and optionally call on_attach/a callback to send the updated list of workspaceFolders to the language server. The only way I can think of to detect the putative additional workspace folder is re-running the root_dir function with the putative new buffer, not sure if the root pattern will be reliable.

mjlbach avatar Nov 12 '21 17:11 mjlbach

@mfussenegger wdyt? ^

mjlbach avatar Nov 12 '21 17:11 mjlbach

With the proposed GOPATH change, the buffer will be attached to the actively running language server (good), but will this buffer may or may not point to a file which is under the server side rootDirectory/workspaceFolders which is bad (I'm not sure navigation/code analysis will work outside of the single attached buffer which lives outside the rootDirectory that has been communicated to the language server.

I'd expect that servers which return locations to files outside of the rootDirectory/workspaceFolder can handle them without the client implicitly updating workspaceFolders

Maybe worth checking with the gopls devs or looking up how the vscode extension handles this.

mfussenegger avatar Nov 18 '21 16:11 mfussenegger

@mfussenegger the issue isn't so much handling them as determining how to attach language servers to files navigated to outside the root directory. Vscode for most extensions IIRC does not attach them. Users want to be able to "hop" through definitions, right now since we solely use roots to determine this it will launch a new server (most of the time in the new "single file mode") for each file. We could instead wrap the location handler to call buf_attach which would bypass single file mode and instead attach a server to the out-of-root file.

mjlbach avatar Nov 19 '21 04:11 mjlbach

We could instead wrap the location handler to call buf_attach which would bypass single file mode and instead attach a server to the out-of-root file.

Wouldn't that imply that it would attach buffers for all returned locations, independent of whether the user navigates to them or not? I guess for goto definition or goto implementation that could be good enough, but for references you might end up attaching dozens of unwanted buffers premature.

right now since we solely use roots to determine this it will launch a new server (most of the time in the new "single file mode") for each file.

Maybe we could extend this. If there is no root_dir for the new file, check if the alternative/source buffer has a client attached and use that. (Maybe behind a gated per language-server configuration flag).

In jdtls I do something like that - except only for jdt:// which is the eclipse.jdt.ls mechanism for opening third party dependencies or JDK libs code. See https://github.com/mfussenegger/nvim-jdtls/blob/3fa992f33378fd811aed74c56e0affd33f42dae0/lua/jdtls/setup.lua#L211-L215

mfussenegger avatar Nov 19 '21 10:11 mfussenegger

@mjlbach:

(most of the time in the new "single file mode")

When ccls jump outside, we will fail to start a new one because:

https://github.com/neovim/nvim-lspconfig/blob/d285f720ed2b26b687a06e9c7d5d41353dd2b743/lua/lspconfig/server_configurations/ccls.lua#L8

@mfussenegger:

Wouldn't that imply that it would attach buffers for all returned locations, independent of whether the user navigates to them or not?

I think this is a good enough solution. I think emacs's lsp-mode also works like this. Check https://github.com/emacs-lsp/lsp-mode/issues/225.

black-desk avatar Jan 10 '22 16:01 black-desk

I think this is a good enough solution.

It can have quite the performance impact. I think in order to attach the client we would need to load the buffer. That would trigger all autocmds. If you for example look for references and get a couple hundreds of results - that can take a long time and freeze the UI if it's running on the main loop.

We made some optimizations in core specifically to avoid having to do that.

mfussenegger avatar Jan 10 '22 16:01 mfussenegger

We could set up a "catch-all" autocommand that is shared across all servers that attaches servers when entering that buffer, so the results of a references/definition request can be cached globally and the server lazily attached when entering the buffer.

mjlbach avatar Jan 10 '22 16:01 mjlbach

Btw, setting the GOPATH isn't standard practice anymore. The mod cache directory should be determined using "$(go env GOPATH)/pkg/mod". I've updated the workaround provided by @Snyssfx with this in mind

local lastRootPath = nil
local gomodpath = vim.trim(vim.fn.system("go env GOPATH")) .. "/pkg/mod"

nvim_lsp.gopls.setup({
  root_dir = function(fname)
    local fullpath = vim.fn.expand(fname, ":p")
    if string.find(fullpath, gomodpath) and lastRootPath ~= nil then
        return lastRootPath
    end
    local root = nvim_lsp.util.root_pattern("go.mod", ".git")(fname)
    if root ~= nil then
        lastRootPath = root
    end
    return root
  end,
})

icholy avatar Oct 11 '22 16:10 icholy

gomodpath

I think you may have a typo there, the variable is declared as gomodpath but you use gopathmod.

itaranto avatar Oct 12 '22 15:10 itaranto

@mjlbach this issue has been open for 2+ years. @Snyssfx's solution is hacky, but it works flawlessly. Can we reboot https://github.com/neovim/nvim-lspconfig/pull/879 ?

icholy avatar Jun 08 '23 13:06 icholy

cc @glepnir

icholy avatar Jun 08 '23 13:06 icholy

I don't use neovim anymore, and I'm not the maintainer of lspconfig as of more than a year ago

mjlbach avatar Jun 08 '23 13:06 mjlbach

@mjlbach Not sure what happened. When I return from illness. some people left.

@icholy I will review it later

glepnir avatar Jun 08 '23 14:06 glepnir