Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: Completion not working in modules with "vendor" as their name #54071

Closed
chenaoxd opened this issue Jul 26, 2022 · 2 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@chenaoxd
Copy link

gopls version

Build info
----------
golang.org/x/tools/gopls v0.9.1
    golang.org/x/tools/gopls@v0.9.1 h1:SigsTL4Hpv3a6b/a7oPCLRv5QUeSM6PZNdta1oKY4B0=
    github.com/BurntSushi/toml@v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
    github.com/google/go-cmp@v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/exp/typeparams@v0.0.0-20220218215828-6cf2b201936e h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM=
    golang.org/x/mod@v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
    golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
    golang.org/x/sys@v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
    golang.org/x/text@v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
    golang.org/x/tools@v0.1.12-0.20220713141851-7464a5a40219 h1:Ljlba2fVWOA1049JjsKii44g8nZN2GjpxMlzVc8AnQM=
    golang.org/x/vuln@v0.0.0-20220613164644-4eb5ba49563c h1:r5bbIROBQtRRgoutV8Q3sFY58VzHW6jMBYl48ANSyS4=
    honnef.co/go/tools@v0.3.2 h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34=
    mvdan.cc/gofumpt@v0.3.0 h1:kTojdZo9AcEYbQYhGuLf/zszYthRdhDNDUi2JKTxas4=
    mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.18.4

go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/chenao/.cache/go-build"
GOENV="/home/chenao/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/chenao/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="somedomain.com"
GOOS="linux"
GOPATH="/home/chenao/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/chenao/github.com/chenaoxd/gopls-bug/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3157977497=/tmp/go-build -gno-record-gcc-switches"

What did you do?

There's a repo to reproduce this issue: https://github.com/chenaoxd/gopls-bug, the gopls will simply not work in files that are in a module with "vendor" as the module name. Such as in the demo/vendor/test.go.

Some screenshots:
image

What did you expect to see?

The gopls completion work as normal.

What did you see instead?

It breaks, and always give the same completion candidates.

Editor and settings

Editor: Neovim + coc.neovim
Config:

"languageserver": {
     "go": {
            "command": "gopls",
            "rootPatterns": ["go.mod"],
            "trace.server": "verbose",
            "filetypes": ["go"]
     },
     ...
}

Logs

[Trace - 02:10:27.065 AM] Sending request 'initialize - (0)'.
Params: {"processId":994099,"rootPath":"/home/chenao/github.com/chenaoxd/gopls-bug","rootUri":"file:///home/chenao/github.com/chenaoxd/gopls-bug","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"undo","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":false}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":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]},"tagSupport":{"valueSet":[1]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"semanticTokens":{"refreshSupport":true},"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":true,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"insertReplaceSupport":true,"tagSupport":{"valueSet":[1]},"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"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]},"insertTextMode":2},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"contextSupport":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true,"parameterInformation":{"labelOffsetSupport":true}}},"references":{"dynamicRegistration":true},"definition":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":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]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"honorsChangeAnnotations":false,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true},"implementation":{"dynamicRegistration":true},"declaration":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"linkedEditingRange":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"4.0.10"}}},"initializationOptions":{},"trace":"verbose","workspaceFolders":[{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug","name":"gopls-bug"}],"locale":"en_US","clientInfo":{"name":"coc.nvim","version":"0.0.81"}}


[Trace - 02:10:27.066 AM] Received response 'initialize - (0)' in 1ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."],"completionItem":{}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.rewrite","source.fixAll","source.organizeImports"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.apply_fix","gopls.check_upgrades","gopls.edit_go_directive","gopls.gc_details","gopls.generate","gopls.generate_gopls_mod","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.regenerate_cgo","gopls.remove_dependency","gopls.run_tests","gopls.run_vulncheck_exp","gopls.start_debugging","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor"]},"callHierarchyProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}},"inlayHintProvider":{}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.18.4\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"v0.9.1\",\"Sum\":\"h1:SigsTL4Hpv3a6b/a7oPCLRv5QUeSM6PZNdta1oKY4B0=\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.0.0\",\"Sum\":\"h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.5.7\",\"Sum\":\"h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=\",\"Replace\":null},{\"Path\":\"github.com/sergi/go-diff\",\"Version\":\"v1.1.0\",\"Sum\":\"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20220218215828-6cf2b201936e\",\"Sum\":\"h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM=\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.6.0-dev.0.20220419223038-86c51ed26bb4\",\"Sum\":\"h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.0.0-20210220032951-036812b2e83c\",\"Sum\":\"h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=\",\"Replace\":null},{\"Path\":\"golang.org/x/sys\",\"Version\":\"v0.0.0-20220209214540-3681064d5158\",\"Sum\":\"h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.3.7\",\"Sum\":\"h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.1.12-0.20220713141851-7464a5a40219\",\"Sum\":\"h1:Ljlba2fVWOA1049JjsKii44g8nZN2GjpxMlzVc8AnQM=\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v0.0.0-20220613164644-4eb5ba49563c\",\"Sum\":\"h1:r5bbIROBQtRRgoutV8Q3sFY58VzHW6jMBYl48ANSyS4=\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.3.2\",\"Sum\":\"h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34=\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.3.0\",\"Sum\":\"h1:kTojdZo9AcEYbQYhGuLf/zszYthRdhDNDUi2JKTxas4=\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.4.0\",\"Sum\":\"h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"Key\":\"CGO_ENABLED\",\"Value\":\"1\"},{\"Key\":\"CGO_CFLAGS\",\"Value\":\"-g -O2 -Wno-return-local-addr\"},{\"Key\":\"CGO_CPPFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CXXFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_LDFLAGS\",\"Value\":\"\"},{\"Key\":\"GOARCH\",\"Value\":\"amd64\"},{\"Key\":\"GOOS\",\"Value\":\"linux\"},{\"Key\":\"GOAMD64\",\"Value\":\"v1\"}],\"Version\":\"v0.9.1\"}"}}


[Trace - 02:10:27.075 AM] Sending notification 'initialized'.
Params: {}


[Trace - 02:10:27.075 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":{}}


[Trace - 02:10:27.075 AM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go","languageId":"go","version":1,"text":"package vendor\n\nimport (\n\t\"fmt\"\n)\n\nfunc Test() {\n\tfmt.Println(\"in inner module\")\n}\n"}}


[Trace - 02:10:27.075 AM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"5577006791947779410"}


[Trace - 02:10:27.076 AM] Sending response 'window/workDoneProgress/create - (1)' in 0ms.
Result: 


[Trace - 02:10:27.077 AM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}


[Trace - 02:10:27.077 AM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///home/chenao/github.com/chenaoxd/gopls-bug","section":"gopls"}]}


[Trace - 02:10:27.079 AM] Sending response 'workspace/configuration - (2)' in 2ms.
Result: [null]


[Trace - 02:10:27.088 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2022/07/27 02:10:27 go env for /home/chenao/github.com/chenaoxd/gopls-bug\n(root /home/chenao/github.com/chenaoxd/gopls-bug)\n(go version go version go1.18.4 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOSUMDB=sum.golang.org\nGOCACHE=/home/chenao/.cache/go-build\nGOROOT=/usr/local/go\nGOPATH=/home/chenao/go\nGOPRIVATE=\nGOPROXY=https://goproxy.cn\nGOMOD=/home/chenao/github.com/chenaoxd/gopls-bug/go.mod\nGOMODCACHE=/home/chenao/go/pkg/mod\nGOWORK=\nGOINSECURE=\nGONOSUMDB=somedomain.com\nGOFLAGS=\nGONOPROXY=\nGO111MODULE=\n\n"}


[Trace - 02:10:27.147 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2022/07/27 02:10:27 go/packages.Load #1\n\tsnapshot=0\n\tdirectory=/home/chenao/github.com/chenaoxd/gopls-bug\n\tquery=[builtin chenaoxd.com/chenao/goplsbug/...]\n\tpackages=3\n"}


[Trace - 02:10:27.148 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2022/07/27 02:10:27 go/packages.Load #1: updating metadata for 41 packages\n"}


[Trace - 02:10:27.168 AM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"end","message":"Finished loading packages."}}


[Trace - 02:10:27.168 AM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.{go,mod,sum,work}","kind":7},{"globPattern":"{/home/chenao/github.com/chenaoxd/gopls-bug/demo,/home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor}","kind":7}]}}]}


[Trace - 02:10:27.170 AM] Sending response 'client/registerCapability - (3)' in 1ms.
Result: 


[Trace - 02:10:27.172 AM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}


[Trace - 02:10:27.173 AM] Sending response 'client/registerCapability - (4)' in 1ms.
Result: 


[Trace - 02:10:27.173 AM] Received request 'workspace/configuration - (5)'.
Params: {"items":[{"section":"gopls"}]}


[Trace - 02:10:27.174 AM] Sending response 'workspace/configuration - (5)' in 0ms.
Result: [null]


[Trace - 02:10:27.185 AM] Received request 'workspace/configuration - (6)'.
Params: {"items":[{"scopeUri":"file:///home/chenao/github.com/chenaoxd/gopls-bug","section":"gopls"}]}


[Trace - 02:10:27.190 AM] Sending response 'workspace/configuration - (6)' in 5ms.
Result: [null]


[Trace - 02:10:27.249 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2022/07/27 02:10:27 falling back to safe trimming due to type errors: [/usr/local/go/src/runtime/vdso_linux.go:53:38: invalid operation: division by zero /usr/local/go/src/runtime/vdso_linux.go:54:38: invalid operation: division by zero] or still-missing identifiers: map[memRecordCycle:true pageBits:true]\n\tpackage=\"runtime\"\n"}


[Trace - 02:10:29.724 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":2,"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"contentChanges":[{"range":{"start":{"line":8,"character":0},"end":{"line":8,"character":0}},"text":"\t\n","rangeLength":0}]}


[Trace - 02:10:30.614 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":3,"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"contentChanges":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":1}},"text":"f","rangeLength":0}]}


[Trace - 02:10:30.614 AM] Sending request 'textDocument/completion - (1)'.
Params: {"textDocument":{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"position":{"line":8,"character":2},"context":{"triggerKind":1}}


[Trace - 02:10:30.615 AM] Received response 'textDocument/completion - (1)' in 0ms.
Result: {"isIncomplete":true,"itemDefaults":{"editRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}},"items":[{"label":"const","labelDetails":{},"kind":14,"preselect":true,"sortText":"00000","filterText":"const","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":2}},"newText":"const"}},{"label":"func","labelDetails":{},"kind":14,"sortText":"00001","filterText":"func","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":2}},"newText":"func"}},{"label":"import","labelDetails":{},"kind":14,"sortText":"00002","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":2}},"newText":"import"}},{"label":"type","labelDetails":{},"kind":14,"sortText":"00003","filterText":"type","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":2}},"newText":"type"}},{"label":"var","labelDetails":{},"kind":14,"sortText":"00004","filterText":"var","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":2}},"newText":"var"}}]}


[Trace - 02:10:30.615 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go","version":3,"diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":2}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source=gopls#UndeclaredName"},"source":"compiler","message":"undeclared name: f"}]}


[Trace - 02:10:30.972 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":4,"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"contentChanges":[{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":2}},"text":"m","rangeLength":0}]}


[Trace - 02:10:30.973 AM] Sending request 'textDocument/completion - (2)'.
Params: {"textDocument":{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"position":{"line":8,"character":3},"context":{"triggerKind":3}}


[Trace - 02:10:30.974 AM] Received response 'textDocument/completion - (2)' in 1ms.
Result: {"isIncomplete":true,"itemDefaults":{"editRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}},"items":[{"label":"const","labelDetails":{},"kind":14,"preselect":true,"sortText":"00000","filterText":"const","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":3},"end":{"line":8,"character":3}},"newText":"const"}},{"label":"func","labelDetails":{},"kind":14,"sortText":"00001","filterText":"func","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":3},"end":{"line":8,"character":3}},"newText":"func"}},{"label":"import","labelDetails":{},"kind":14,"sortText":"00002","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":3},"end":{"line":8,"character":3}},"newText":"import"}},{"label":"type","labelDetails":{},"kind":14,"sortText":"00003","filterText":"type","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":3},"end":{"line":8,"character":3}},"newText":"type"}},{"label":"var","labelDetails":{},"kind":14,"sortText":"00004","filterText":"var","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":3},"end":{"line":8,"character":3}},"newText":"var"}}]}


[Trace - 02:10:30.977 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go","version":4,"diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":3}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source=gopls#UndeclaredName"},"source":"compiler","message":"undeclared name: fm"}]}


[Trace - 02:10:31.204 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":5,"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"contentChanges":[{"range":{"start":{"line":8,"character":3},"end":{"line":8,"character":3}},"text":"t","rangeLength":0}]}


[Trace - 02:10:31.205 AM] Sending request 'textDocument/completion - (3)'.
Params: {"textDocument":{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"position":{"line":8,"character":4},"context":{"triggerKind":3}}


[Trace - 02:10:31.206 AM] Received response 'textDocument/completion - (3)' in 1ms.
Result: {"isIncomplete":true,"itemDefaults":{"editRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}},"items":[{"label":"const","labelDetails":{},"kind":14,"preselect":true,"sortText":"00000","filterText":"const","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":4}},"newText":"const"}},{"label":"func","labelDetails":{},"kind":14,"sortText":"00001","filterText":"func","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":4}},"newText":"func"}},{"label":"import","labelDetails":{},"kind":14,"sortText":"00002","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":4}},"newText":"import"}},{"label":"type","labelDetails":{},"kind":14,"sortText":"00003","filterText":"type","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":4}},"newText":"type"}},{"label":"var","labelDetails":{},"kind":14,"sortText":"00004","filterText":"var","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":4}},"newText":"var"}}]}


[Trace - 02:10:31.207 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go","version":5,"diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":4}},"severity":1,"code":"InvalidPkgUse","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source=gopls#InvalidPkgUse"},"source":"compiler","message":"use of package fmt not in selector"}]}


[Trace - 02:10:31.454 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":6,"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"contentChanges":[{"range":{"start":{"line":8,"character":4},"end":{"line":8,"character":4}},"text":".","rangeLength":0}]}


[Trace - 02:10:31.460 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go","version":6,"diagnostics":[{"range":{"start":{"line":8,"character":6},"end":{"line":8,"character":6}},"severity":1,"source":"syntax","message":"expected selector or type assertion, found '}'"}]}


[Trace - 02:10:31.460 AM] Sending request 'textDocument/completion - (4)'.
Params: {"textDocument":{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"position":{"line":8,"character":5},"context":{"triggerKind":2,"triggerCharacter":"."}}


[Trace - 02:10:31.462 AM] Received response 'textDocument/completion - (4)' in 1ms.
Result: {"isIncomplete":true,"itemDefaults":{"editRange":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}},"items":[{"label":"const","labelDetails":{},"kind":14,"preselect":true,"sortText":"00000","filterText":"const","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":5},"end":{"line":8,"character":5}},"newText":"const"}},{"label":"func","labelDetails":{},"kind":14,"sortText":"00001","filterText":"func","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":5},"end":{"line":8,"character":5}},"newText":"func"}},{"label":"import","labelDetails":{},"kind":14,"sortText":"00002","filterText":"import","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":5},"end":{"line":8,"character":5}},"newText":"import"}},{"label":"type","labelDetails":{},"kind":14,"sortText":"00003","filterText":"type","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":5},"end":{"line":8,"character":5}},"newText":"type"}},{"label":"var","labelDetails":{},"kind":14,"sortText":"00004","filterText":"var","insertTextFormat":2,"textEdit":{"range":{"start":{"line":8,"character":5},"end":{"line":8,"character":5}},"newText":"var"}}]}


[Trace - 02:10:32.167 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"version":7,"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"},"contentChanges":[{"range":{"start":{"line":8,"character":0},"end":{"line":9,"character":0}},"text":"","rangeLength":6}]}


[Trace - 02:10:32.171 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go","version":7,"diagnostics":[]}


[Trace - 02:10:32.562 AM] Sending notification 'textDocument/didClose'.
Params: {"textDocument":{"uri":"file:///home/chenao/github.com/chenaoxd/gopls-bug/demo/vendor/test.go"}}



@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jul 26, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jul 26, 2022
@findleyr
Copy link
Contributor

This is a dupe of #53756. Fixing this is unfortunately subtle, as there are many places in the gopls codebase that make assumptions about the meaning of /vendor/. Not sure if this will get done for the v0.9.2 release, but it is a high priority.

@findleyr
Copy link
Contributor

BTW, per my analysis on that issue this has been a long-standing problem. If you observed a recent regression please correct me.

@golang golang locked and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants