Skip to content

x/tools/gopls: error loading workspace folders #68846

Open
@vivekburman

Description

@vivekburman

gopls version

Build info
----------
golang.org/x/tools/gopls v0.16.1
    golang.org/x/tools/gopls@v0.16.1 h1:1hO/dCeUvjEYx3V0rVvCtOkwnpEpqS29paE+Jw4dcAc=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
    golang.org/x/sync@v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
    golang.org/x/sys@v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
    golang.org/x/telemetry@v0.0.0-20240607193123-221703e18637 h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=
    golang.org/x/text@v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
    golang.org/x/tools@v0.22.1-0.20240628205440-9c895dd76b34 h1:Kd+Z5Pm6uwYx3T2KEkeHMHUMZxDPb/q6b1m+zEcy62c=
    golang.org/x/vuln@v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
    honnef.co/go/tools@v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=
    mvdan.cc/gofumpt@v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
    mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.22.3

go env

C:\Users\vivek\go_test>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\vivek\AppData\Local\go-build
set GOENV=C:\Users\vivek\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\vivek\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\vivek\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.3
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\vivek\go_test\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\vivek\AppData\Local\Temp\go-build4249078688=/tmp/go-build -gno-record-gcc-switches

What did you do?

I'm trying to setup Monaco Editor (Browser) with a gopls server.

What did you see happen?

Requests in order:

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":null,"clientInfo":{"name":"Code - OSS","version":"1.91.1"},"locale":"en","rootPath":"c:\\users\\vivek\\go_test","rootUri":"file:///c%3A/users/vivek/go_test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":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]},"resolveSupport":{"properties":["location.range"]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"didChangeConfiguration":{"dynamicRegistration":true},"foldingRange":{"refreshSupport":true},"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"inlineValue":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"diagnostics":{"refreshSupport":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"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,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true},"insertTextMode":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]},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"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,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":true},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true,"rangesSupport":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true,"foldingRangeKind":{"valueSet":["comment","imports","region"]},"foldingRange":{"collapsedText":false}},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"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","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false,"serverCancelSupport":true,"augmentsSyntaxTokens":true},"linkedEditingRange":{"dynamicRegistration":true},"typeHierarchy":{"dynamicRegistration":true},"inlineValue":{"dynamicRegistration":true},"inlayHint":{"dynamicRegistration":true,"resolveSupport":{"properties":["tooltip","textEdits","label.tooltip","label.location","label.command"]}},"diagnostic":{"dynamicRegistration":true,"relatedDocumentSupport":false}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]},"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"},"positionEncodings":["utf-16"]},"notebookDocument":{"synchronization":{"dynamicRegistration":true,"executionSummarySupport":true}}},"trace":"off","workspaceFolders":[{"uri":"file:///c%3A/users/vivek/go_test","name":"go_test"}]}}
{"jsonrpc":"2.0","id":2,"result":{"id":2,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///C:/users/vivek/go_test","section":"gopls"}]}}}
{"jsonrpc":"2.0","id":0,"result":{"jsonrpc":"2.0","method":"window/showMessage","params":{"message":"Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///c%3A/users/vivek/go_test: failed to get workspace configuration from client (file:///C:/users/vivek/go_test): unmarshaling result: json: cannot unmarshal string into Go value of type []interface {}\n","type":1}}}

What did you expect to see?

I expected it to properly configure gopls server on my folder. Allow relaying information back to monaco editor

Editor and settings

No response

Logs

21:09:33.174 start initialize method="initialize" direction="in" id="#0"
21:09:33.174 start queued
21:09:33.174 end queued (+0s)
21:09:33.174 start lsp.Server.initialize
21:09:33.174 end lsp.Server.initialize (+0s)
21:09:33.175 end initialize (+1.6245ms) method="initialize" direction="in" id="#0"
21:09:33.175 event (+1.6245ms) label= status.code="OK"
21:09:33.174 start queued
21:09:33.174 end queued (+0s)
21:09:33.174 start lsp.Server.initialize
21:09:33.174 end lsp.Server.initialize (+0s)
21:09:33.180 start initialized method="initialized" direction="in" id="#1"
21:09:33.180 start queued
21:09:33.180 end queued (+0s)
21:09:33.180 start lsp.Server.initialized
21:09:33.180 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="out" id="#1"
21:09:33.180 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="in"
21:09:33.180 start queued
21:09:33.180 end window/workDoneProgress/create (+564.7µs) method="window/workDoneProgress/create" direction="out" id="#1"
21:09:33.180 event (+564.7µs) label= status.code="OK"
21:09:33.180 start $/progress method="$/progress" direction="out"
21:09:33.181 end $/progress (+504.7µs) method="$/progress" direction="out"
21:09:33.181 event (+1.0694ms) label= status.code="OK"
21:09:33.181 start workspace/configuration method="workspace/configuration" direction="out" id="#2"
21:09:33.181 start $/progress method="$/progress" direction="in"
21:09:33.181 start queued
21:09:33.181 end workspace/configuration (+0s) method="workspace/configuration" direction="out" id="#2"
21:09:33.181 event (+1.1284ms) label= status.code="ERROR"
21:09:33.181 start $/progress method="$/progress" direction="out"
21:09:33.181 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.181 event (+1.1284ms) label= status.code="OK"
21:09:33.181 start client/registerCapability method="client/registerCapability" direction="out" id="#3"
21:09:33.181 start workspace/configuration method="workspace/configuration" direction="in"
21:09:33.182 start queued
21:09:33.182 start $/progress method="$/progress" direction="in"
21:09:33.182 start queued
21:09:33.182 start client/registerCapability method="client/registerCapability" direction="in"
21:09:33.182 start queued
21:09:33.183 end client/registerCapability (+2.3558ms) method="client/registerCapability" direction="out" id="#3"
21:09:33.183 event (+3.4842ms) label= status.code="OK"
21:09:33.183 start window/showMessage method="window/showMessage" direction="out"
21:09:33.183 end window/showMessage (+0s) method="window/showMessage" direction="out"
21:09:33.183 event (+3.4842ms) label= status.code="OK"
21:09:33.183 start client/registerCapability method="client/registerCapability" direction="out" id="#4"
21:09:33.183 start window/showMessage method="window/showMessage" direction="in"
21:09:33.184 start queued
21:09:33.184 start client/registerCapability method="client/registerCapability" direction="in"
21:09:33.184 start queued
21:09:33.184 end client/registerCapability (+505.1µs) method="client/registerCapability" direction="out" id="#4"
21:09:33.184 event (+3.9893ms) label= status.code="OK"
21:09:33.184 end lsp.Server.initialized (+3.9893ms)
21:09:33.180 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="out" id="#1"
21:09:33.180 end window/workDoneProgress/create (+564.7µs) method="window/workDoneProgress/create" direction="out" id="#1"
21:09:33.180 event (+564.7µs) label= status.code="OK"
21:09:33.180 start $/progress method="$/progress" direction="out"
21:09:33.181 end $/progress (+504.7µs) method="$/progress" direction="out"
21:09:33.181 event (+1.0694ms) label= status.code="OK"
21:09:33.181 start workspace/configuration method="workspace/configuration" direction="out" id="#2"
21:09:33.181 end workspace/configuration (+0s) method="workspace/configuration" direction="out" id="#2"
21:09:33.181 event (+1.1284ms) label= status.code="ERROR"
21:09:33.181 start $/progress method="$/progress" direction="out"
21:09:33.181 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.181 event (+1.1284ms) label= status.code="OK"
21:09:33.181 start client/registerCapability method="client/registerCapability" direction="out" id="#3"
21:09:33.183 end client/registerCapability (+2.3558ms) method="client/registerCapability" direction="out" id="#3"
21:09:33.183 event (+3.4842ms) label= status.code="OK"
21:09:33.183 start window/showMessage method="window/showMessage" direction="out"
21:09:33.183 end window/showMessage (+0s) method="window/showMessage" direction="out"
21:09:33.183 event (+3.4842ms) label= status.code="OK"
21:09:33.183 start client/registerCapability method="client/registerCapability" direction="out" id="#4"
21:09:33.184 end client/registerCapability (+505.1µs) method="client/registerCapability" direction="out" id="#4"
21:09:33.184 event (+3.9893ms) label= status.code="OK"
21:09:33.184 end initialized (+3.9893ms) method="initialized" direction="in" id="#1"
21:09:33.184 event (+3.9893ms) label= status.code="OK"
21:09:33.180 start queued
21:09:33.180 end queued (+0s)
21:09:33.180 start lsp.Server.initialized
21:09:33.184 end lsp.Server.initialized (+3.9893ms)
21:09:33.180 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="out" id="#1"
21:09:33.180 end window/workDoneProgress/create (+564.7µs) method="window/workDoneProgress/create" direction="out" id="#1"
21:09:33.180 event (+564.7µs) label= status.code="OK"
21:09:33.180 start $/progress method="$/progress" direction="out"
21:09:33.181 end $/progress (+504.7µs) method="$/progress" direction="out"
21:09:33.181 event (+1.0694ms) label= status.code="OK"
21:09:33.181 start workspace/configuration method="workspace/configuration" direction="out" id="#2"
21:09:33.181 end workspace/configuration (+0s) method="workspace/configuration" direction="out" id="#2"
21:09:33.181 event (+1.1284ms) label= status.code="ERROR"
21:09:33.181 start $/progress method="$/progress" direction="out"
21:09:33.181 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.181 event (+1.1284ms) label= status.code="OK"
21:09:33.181 start client/registerCapability method="client/registerCapability" direction="out" id="#3"
21:09:33.183 end client/registerCapability (+2.3558ms) method="client/registerCapability" direction="out" id="#3"
21:09:33.183 event (+3.4842ms) label= status.code="OK"
21:09:33.183 start window/showMessage method="window/showMessage" direction="out"
21:09:33.183 end window/showMessage (+0s) method="window/showMessage" direction="out"
21:09:33.183 event (+3.4842ms) label= status.code="OK"
21:09:33.183 start client/registerCapability method="client/registerCapability" direction="out" id="#4"
21:09:33.184 end client/registerCapability (+505.1µs) method="client/registerCapability" direction="out" id="#4"
21:09:33.184 event (+3.9893ms) label= status.code="OK"
21:09:33.184 end queued (+3.8884ms)
21:09:33.185 end window/workDoneProgress/create (+4.3954ms) method="window/workDoneProgress/create" direction="in"
21:09:33.185 event (+4.3954ms) label= status.code="ERROR"
21:09:33.180 start queued
21:09:33.184 end queued (+3.8884ms)
21:09:33.185 end queued (+3.8317ms)
21:09:33.185 end $/progress (+3.8317ms) method="$/progress" direction="in"
21:09:33.185 event (+3.8317ms) label= status.code="ERROR"
21:09:33.181 start queued
21:09:33.185 end queued (+3.8317ms)
21:09:33.185 end queued (+3.327ms)
21:09:33.185 end workspace/configuration (+3.8317ms) method="workspace/configuration" direction="in"
21:09:33.185 event (+3.8317ms) label= status.code="ERROR"
21:09:33.182 start queued
21:09:33.185 end queued (+3.327ms)
21:09:33.185 end queued (+3.327ms)
21:09:33.185 end $/progress (+3.327ms) method="$/progress" direction="in"
21:09:33.185 event (+3.327ms) label= status.code="ERROR"
21:09:33.182 start queued
21:09:33.185 end queued (+3.327ms)
21:09:33.185 end queued (+2.8108ms)
21:09:33.185 end client/registerCapability (+3.327ms) method="client/registerCapability" direction="in"
21:09:33.185 event (+3.327ms) label= status.code="ERROR"
21:09:33.182 start queued
21:09:33.185 end queued (+2.8108ms)
21:09:33.185 end queued (+970.8µs)
21:09:33.185 end window/showMessage (+1.4759ms) method="window/showMessage" direction="in"
21:09:33.185 event (+1.4759ms) label= status.code="ERROR"
21:09:33.184 start queued
21:09:33.185 end queued (+970.8µs)
21:09:33.185 end queued (+970.8µs)
21:09:33.185 end client/registerCapability (+970.8µs) method="client/registerCapability" direction="in"
21:09:33.185 event (+970.8µs) label= status.code="ERROR"
21:09:33.184 start queued
21:09:33.185 end queued (+970.8µs)
21:09:33.199 start textDocument/didOpen method="textDocument/didOpen" direction="in" id="#2"
21:09:33.199 start queued
21:09:33.199 end queued (+0s)
21:09:33.199 start lsp.Server.didOpen URI=file:///C:/users/vivek/go_test/postgres_db_sql_source/something.go
21:09:33.199 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="out" id="#5"
21:09:33.200 end window/workDoneProgress/create (+507µs) method="window/workDoneProgress/create" direction="out" id="#5"
21:09:33.200 event (+507µs) label= status.code="OK"
21:09:33.200 start $/progress method="$/progress" direction="out"
21:09:33.200 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.200 event (+507µs) label= status.code="OK"
21:09:33.200 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="in"
21:09:33.200 start workspace/configuration method="workspace/configuration" direction="out" id="#6"
21:09:33.200 start queued
21:09:33.200 start $/progress method="$/progress" direction="in"
21:09:33.200 start queued
21:09:33.200 end workspace/configuration (+0s) method="workspace/configuration" direction="out" id="#6"
21:09:33.200 event (+507µs) label= status.code="ERROR"
21:09:33.200 start workspace/configuration method="workspace/configuration" direction="in"
21:09:33.200 start $/progress method="$/progress" direction="out"
21:09:33.200 start queued
21:09:33.200 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.200 event (+1.0301ms) label= status.code="OK"
21:09:33.200 start window/showMessage method="window/showMessage" direction="out"
21:09:33.200 end window/showMessage (+0s) method="window/showMessage" direction="out"
21:09:33.200 event (+1.0301ms) label= status.code="OK"
21:09:33.200 start $/progress method="$/progress" direction="in"
21:09:33.200 start queued
21:09:33.201 start window/showMessage method="window/showMessage" direction="in"
21:09:33.201 start queued
21:09:33.201 start cache.readFile file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end cache.readFile (+1.6671ms) file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end lsp.Server.didOpen (+3.3383ms) URI=file:///C:/users/vivek/go_test/postgres_db_sql_source/something.go
21:09:33.199 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="out" id="#5"
21:09:33.200 end window/workDoneProgress/create (+507µs) method="window/workDoneProgress/create" direction="out" id="#5"
21:09:33.200 event (+507µs) label= status.code="OK"
21:09:33.200 start $/progress method="$/progress" direction="out"
21:09:33.200 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.200 event (+507µs) label= status.code="OK"
21:09:33.200 start workspace/configuration method="workspace/configuration" direction="out" id="#6"
21:09:33.200 end workspace/configuration (+0s) method="workspace/configuration" direction="out" id="#6"
21:09:33.200 event (+507µs) label= status.code="ERROR"
21:09:33.200 start $/progress method="$/progress" direction="out"
21:09:33.200 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.200 event (+1.0301ms) label= status.code="OK"
21:09:33.200 start window/showMessage method="window/showMessage" direction="out"
21:09:33.200 end window/showMessage (+0s) method="window/showMessage" direction="out"
21:09:33.200 event (+1.0301ms) label= status.code="OK"
21:09:33.201 start cache.readFile file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end cache.readFile (+1.6671ms) file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 start cache.ParseGoSrc file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end cache.ParseGoSrc (+0s) file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end textDocument/didOpen (+3.3383ms) method="textDocument/didOpen" direction="in" id="#2"
21:09:33.203 event (+3.3383ms) label= status.code="OK"
21:09:33.199 start queued
21:09:33.199 end queued (+0s)
21:09:33.199 start lsp.Server.didOpen URI=file:///C:/users/vivek/go_test/postgres_db_sql_source/something.go
21:09:33.203 end lsp.Server.didOpen (+3.3383ms) URI=file:///C:/users/vivek/go_test/postgres_db_sql_source/something.go
21:09:33.199 start window/workDoneProgress/create method="window/workDoneProgress/create" direction="out" id="#5"
21:09:33.200 end window/workDoneProgress/create (+507µs) method="window/workDoneProgress/create" direction="out" id="#5"
21:09:33.200 event (+507µs) label= status.code="OK"
21:09:33.200 start $/progress method="$/progress" direction="out"
21:09:33.200 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.200 event (+507µs) label= status.code="OK"
21:09:33.200 start workspace/configuration method="workspace/configuration" direction="out" id="#6"
21:09:33.200 end workspace/configuration (+0s) method="workspace/configuration" direction="out" id="#6"
21:09:33.200 event (+507µs) label= status.code="ERROR"
21:09:33.200 start $/progress method="$/progress" direction="out"
21:09:33.200 end $/progress (+0s) method="$/progress" direction="out"
21:09:33.200 event (+1.0301ms) label= status.code="OK"
21:09:33.200 start window/showMessage method="window/showMessage" direction="out"
21:09:33.200 end window/showMessage (+0s) method="window/showMessage" direction="out"
21:09:33.200 event (+1.0301ms) label= status.code="OK"
21:09:33.201 start cache.readFile file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end cache.readFile (+1.6671ms) file="C:\\users\\vivek\\go_test\\postgres_db_sql_source\\something.go"
21:09:33.203 end queued (+2.8313ms)
21:09:33.203 end window/workDoneProgress/create (+2.8313ms) method="window/workDoneProgress/create" direction="in"
21:09:33.203 event (+2.8313ms) label= status.code="ERROR"
21:09:33.200 start queued
21:09:33.203 end queued (+2.8313ms)
21:09:33.203 end queued (+2.8313ms)
21:09:33.203 end $/progress (+2.8313ms) method="$/progress" direction="in"
21:09:33.203 event (+2.8313ms) label= status.code="ERROR"
21:09:33.200 start queued
21:09:33.203 end queued (+2.8313ms)
21:09:33.203 end queued (+2.3082ms)
21:09:33.203 end workspace/configuration (+2.3082ms) method="workspace/configuration" direction="in"
21:09:33.203 event (+2.3082ms) label= status.code="ERROR"
21:09:33.200 start queued
21:09:33.203 end queued (+2.3082ms)
21:09:33.203 end queued (+2.3082ms)
21:09:33.203 end $/progress (+2.8323ms) method="$/progress" direction="in"
21:09:33.203 event (+2.8323ms) label= status.code="ERROR"
21:09:33.200 start queued
21:09:33.203 end queued (+2.3082ms)
21:09:33.203 end queued (+2.3409ms)
21:09:33.203 end window/showMessage (+2.3409ms) method="window/showMessage" direction="in"
21:09:33.203 event (+2.3409ms) label= status.code="ERROR"
21:09:33.201 start queued
21:09:33.203 end queued (+2.3409ms)
21:09:33.203 start textDocument/publishDiagnostics method="textDocument/publishDiagnostics" direction="out"
21:09:33.203 end textDocument/publishDiagnostics (+0s) method="textDocument/publishDiagnostics" direction="out"
21:09:33.203 event (+0s) label= status.code="OK"
21:09:33.203 start textDocument/publishDiagnostics method="textDocument/publishDiagnostics" direction="in"
21:09:33.204 start queued
21:09:33.204 end queued (+0s)
21:09:33.204 end textDocument/publishDiagnostics (+505.3µs) method="textDocument/publishDiagnostics" direction="in"
21:09:33.204 event (+505.3µs) label= status.code="ERROR"
21:09:33.204 start queued
21:09:33.204 end queued (+0s)

Activity

added
goplsIssues related to the Go language server, gopls.
ToolsThis label describes issues relating to any tools in the x/tools repository.
on Aug 12, 2024
changed the title [-]Error loading workspace folders[/-] [+]x/tools/gopls: error loading workspace folders[/+] on Aug 13, 2024
added this to the Unreleased milestone on Aug 13, 2024
vivekburman

vivekburman commented on Aug 15, 2024

@vivekburman
Author

Hi, I did go through the docs and made changes:
Current flow:

  1. Frontend React makes request to Golang server via websocket
  2. Request if forwarded to gopls server
  3. Returns the response back to Frontend

Specific error message:
`
: {"jsonrpc":"2.0","method":"$/progress","params":{"token":"723829060117214342","value":{"kind":"end","message":"Error loading packages: failed to get workspace configuration from client (file:///C:/users/vivek/go_test): unmarshaling result: json: cannot unmarshal string into Go value of type []interface {}"}}}

`

below are the logs of Inbound, Outbound data
`
Inbound: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"capabilities":{"general":{"markdown":{"parser":"marked","version":"1.1.0"},"positionEncodings":["utf-16"],"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]}},"notebookDocument":{"synchronization":{"dynamicRegistration":true,"executionSummarySupport":true}},"textDocument":{"callHierarchy":{"dynamicRegistration":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"dynamicRegistration":true,"honorsChangeAnnotations":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit"]}},"codeLens":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},"completion":{"completionItem":{"commitCharactersSupport":true,"deprecatedSupport":true,"documentationFormat":["markdown","plaintext"],"insertReplaceSupport":true,"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true,"preselectSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"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]},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]},"contextSupport":true,"dynamicRegistration":true,"insertTextMode":2},"declaration":{"dynamicRegistration":true,"linkSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"diagnostic":{"dynamicRegistration":true,"relatedDocumentSupport":false},"documentHighlight":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"documentSymbol":{"dynamicRegistration":true,"hierarchicalDocumentSymbolSupport":true,"labelSupport":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]}},"foldingRange":{"dynamicRegistration":true,"foldingRange":{"collapsedText":false},"foldingRangeKind":{"valueSet":["comment","imports","region"]},"lineFoldingOnly":true,"rangeLimit":5000},"formatting":{"dynamicRegistration":true},"hover":{"contentFormat":["markdown","plaintext"],"dynamicRegistration":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"inlayHint":{"dynamicRegistration":true,"resolveSupport":{"properties":["tooltip","textEdits","label.tooltip","label.location","label.command"]}},"inlineValue":{"dynamicRegistration":true},"linkedEditingRange":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"publishDiagnostics":{"codeDescriptionSupport":true,"dataSupport":true,"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":false},"rangeFormatting":{"dynamicRegistration":true,"rangesSupport":true},"references":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"honorsChangeAnnotations":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1},"selectionRange":{"dynamicRegistration":true},"semanticTokens":{"augmentsSyntaxTokens":true,"dynamicRegistration":true,"formats":["relative"],"multilineTokenSupport":false,"overlappingTokenSupport":false,"requests":{"full":{"delta":true},"range":true},"serverCancelSupport":true,"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"]},"signatureHelp":{"contextSupport":true,"dynamicRegistration":true,"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true,"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"typeHierarchy":{"dynamicRegistration":true}},"window":{"showDocument":{"support":true},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"workDoneProgress":true},"workspace":{"applyEdit":true,"codeLens":{"refreshSupport":true},"configuration":true,"diagnostics":{"refreshSupport":true},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"executeCommand":{"dynamicRegistration":true},"fileOperations":{"didCreate":true,"didDelete":true,"didRename":true,"dynamicRegistration":true,"willCreate":true,"willDelete":true,"willRename":true},"foldingRange":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"inlineValue":{"refreshSupport":true},"semanticTokens":{"refreshSupport":true},"symbol":{"dynamicRegistration":true,"resolveSupport":{"properties":["location.range"]},"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]}},"workspaceEdit":{"changeAnnotationSupport":{"groupsOnLabel":true},"documentChanges":true,"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"resourceOperations":["create","rename","delete"]}}},"clientInfo":{"name":"Code - OSS","version":"1.92.1"},"locale":"en","processId":null,"rootPath":"c:\users\vivek\go_test","rootUri":"file:///c:/users/vivek/go_test","trace":"off","workspaceFolders":[{"name":"go_test","uri":"file:///c:/users/vivek/go_test"}]}}

2024-08-15T12:43:37.845+0530 INFO helper/gointellisense.go:37 Inbound: {"jsonrpc":"2.0","method":"initialized","params":{}}

2024-08-15T12:43:37.845+0530 INFO helper/gointellisense.go:68 Modified Inbound Params: {}

2024-08-15T12:43:37.846+0530 INFO helper/gointellisense.go:98 Outbound: {"id":1,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"723829060117214342"}}

2024-08-15T12:43:37.846+0530 INFO helper/gointellisense.go:98 Outbound: {"jsonrpc":"2.0","method":"$/progress","params":{"token":"723829060117214342","value":{"kind":"begin","message":"Loading packages...","title":"Setting up workspace"}}}

2024-08-15T12:43:37.847+0530 INFO helper/gointellisense.go:98 Outbound: {"id":2,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///C:/users/vivek/go_test","section":"gopls"}]}}

2024-08-15T12:43:37.848+0530 INFO helper/gointellisense.go:98 Outbound: {"jsonrpc":"2.0","method":"$/progress","params":{"token":"723829060117214342","value":{"kind":"end","message":"Error loading packages: failed to get workspace configuration from client (file:///C:/users/vivek/go_test): unmarshaling result: json: cannot unmarshal string into Go value of type []interface {}"}}}

2024-08-15T12:43:37.848+0530 INFO helper/gointellisense.go:98 Outbound: {"id":3,"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.{mod,work}","kind":7}]}}]}}

2024-08-15T12:43:37.849+0530 INFO helper/gointellisense.go:98 Outbound: {"jsonrpc":"2.0","method":"window/showMessage","params":{"message":"Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///c:/users/vivek/go_test: failed to get workspace configuration from client (file:///C:/users/vivek/go_test): unmarshaling result: json: cannot unmarshal string into Go value of type []interface {}\n","type":1}}

2024-08-15T12:43:37.849+0530 INFO helper/gointellisense.go:98 Outbound: {"id":4,"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}}
2024-08-15T12:43:39.964+0530 INFO helper/gointellisense.go:37 Inbound: {"jsonrpc":"2.0","method":"$/setTrace","params":{"value":"off"}}
2024-08-15T12:43:39.964+0530 INFO helper/gointellisense.go:68 Modified Inbound Params: {"value":"off"}
2024-08-15T12:43:39.965+0530 ERROR helper/gointellisense.go:72 Failed to call rpc {"error": "jsonrpc2: code -32601 message: JSON RPC method not found: "SetTrace" not yet implemented"}
streamcraft/helper.proxyMessages
C:/Users/vivek/streamcraft/helper/gointellisense.go:72
`

findleyr

findleyr commented on Aug 15, 2024

@findleyr
Member

Hi, just catching up on this, it looks like perhaps the workspace/configuration request is getting invalid JSON in its response?

Are you able to capture the raw logs? I suspect we may only be seeing those with valid JSON. One way to do this would be to start gopls with -rpc.trace -logfile=/path/to/gopls.log.

vivekburman

vivekburman commented on Aug 16, 2024

@vivekburman
Author

logs.txt
Are you referring to these debug logs?. I tried -logfile="path/to/log/file". But only session connected logs were there.

findleyr

findleyr commented on Aug 16, 2024

@findleyr
Member

@vivekburman did you add -rpc.trace to your gopls command line?

vivekburman

vivekburman commented on Aug 16, 2024

@vivekburman
Author

Yes, cmd: "gopls -port=8080 serve -rpc.trace -logfile=C:/Users/Vivek/gopls.log"

This is all i see.
serve.go:132: Gopls daemon: listening on tcp network, address :8080... lsprpc.go:90: Session 1: connected lsprpc.go:94: Session 1: exited lsprpc.go:90: Session 2: connected

findleyr

findleyr commented on Aug 16, 2024

@findleyr
Member

Got it. That's the gopls daemon. Can you add those arguments to the gopls process started by your editor, which is communicating with the daemon?

vivekburman

vivekburman commented on Aug 16, 2024

@vivekburman
Author

I'm triggering gopls manually from cmd prompt. Not using any editor

findleyr

findleyr commented on Aug 16, 2024

@findleyr
Member

@vivekburman how are you communicating with that gopls instance? Is you LSP client communicating directly over tcp?

vivekburman

vivekburman commented on Aug 16, 2024

@vivekburman
Author

So I've my main golang app server running on a port and then LSP server is started as a process in a different PORT. Now to bridge them with frontend client. I'm opening a websocket on golang app server. And using "github.com/sourcegraph/jsonrpc2" to proxy the messages back and forth from client to LSP.

findleyr

findleyr commented on Aug 16, 2024

@findleyr
Member

Understood. I'm not aware of anyone trying to use gopls in this way -- typically the daemon communicates with a sidecar gopls instance that forwards the LSP. However, I suppose it should work.

The error message seems to be saying that the response to workspace/configuration coming from your client is a string, not []LSPAny, as defined by the spec:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration

If you could capture the wire-level RPC transcript, I can perhaps provide more help.

vivekburman

vivekburman commented on Aug 17, 2024

@vivekburman
Author

{"id":2,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///C:/users/vivek/go_test","section":"gopls"}]}}

Here I see this request. Going out from server to Monaco Editor. But can you tell me what to expect? After this.

Sure I can provide the wire-level RPC transcript. Can you let me know where and how to get those? Any docs?

findleyr

findleyr commented on Aug 29, 2024

@findleyr
Member

@vivekburman sorry for going silent on this issue.

I'm not sure the best way to capture the exact transcript, since we've not supported this communication mode in the past. Can you record exactly what your client receives and sends?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gopherbot@vivekburman@findleyr@gabyhelp

        Issue actions

          x/tools/gopls: error loading workspace folders · Issue #68846 · golang/go