You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed the following broken code by replacing bytes.NewReader with strings.NewReader and then and triggered file save (so code action)
package main
import (
"bytes"
"encoding/json"
"time"
)
type IndexVersion struct {
Path string // the name of the module
Version string
Timestamp time.Time
}
func main() {
findInIndex := func(index string, name, ver string) bool {
reader := bytes.NewReader(index) // <-- error
dec := json.NewDecoder(reader)
for dec.More() {
var v IndexVersion
if err := dec.Decode(&v); err != nil {
break
}
if v.Path == name && v.Version == ver {
return true
}
}
return false
}
x := findInIndex(data, "git.apache.org/thrift.git", "v0.0.0-20180807212849-6e67faa92827")
print(x)
}
const data = `{"Path":"golang.org/x/text","Version":"v0.3.0","Timestamp":"2019-04-10T19:08:52.997264Z"}
{"Path":"golang.org/x/crypto","Version":"v0.0.0-20190404164418-38d8ce5564a5","Timestamp":"2019-04-10T20:30:02.04035Z"}`
What did you expect to see?
Code action response with high latency. (VS Code shows the notorious "Saving "main.go": Getting Code Action From Go..." popup)
I manually triggered file save which corresponds to messageseq 46. Note that there were diagnostics and completion requests queued up due to my file edits (delete bytes and type strings) before file save.
[Trace - 10:27:10.158 AM] Sending request 'initialize - (0)'.
Params: {...}
[Trace - 10:27:10.166 AM] Sending notification 'initialized'.
Params: {}
[Trace - 10:27:10.166 AM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"3000518084189521886"}
[Trace - 10:27:10.198 AM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","languageId":"go","version":1,"text":"package main\n\nimport (\n\t\"encoding/json\"\n\t\"strings\"\n\t\"time\"\n)\n\ntype IndexVersion struct {\n\tPath string // the name of the module\n\tVersion string\n\tTimestamp time.Time\n}\n\nfunc main() {\n\tfindInIndex := func(index string, name, ver string) bool {\n\t\treader := bytes.NewReader(index)\n\t\tdec := json.NewDecoder(reader)\n\t\tfor dec.More() {\n\t\t\tvar v IndexVersion\n\t\t\tif err := dec.Decode(&v); err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif v.Path == name && v.Version == ver {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tx := findInIndex(data, \"git.apache.org/thrift.git\", \"v0.0.0-20180807212849-6e67faa92827\")\n\tprint(x)\n}\n\nconst data = `{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.3.0\",\"Timestamp\":\"2019-04-10T19:08:52.997264Z\"}\n{\"Path\":\"golang.org/x/crypto\",\"Version\":\"v0.0.0-20190404164418-38d8ce5564a5\",\"Timestamp\":\"2019-04-10T20:30:02.04035Z\"}`\n"}}
[Trace - 10:27:10.199 AM] Sending response 'window/workDoneProgress/create - (1)' in 32ms.
Result:
[Trace - 10:27:10.199 AM] Received notification '$/progress'.
Params: {"token":"3000518084189521886","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}
[Trace - 10:27:10.200 AM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/projects/foo","section":"gopls"}]}
[Trace - 10:27:10.206 AM] Sending response 'workspace/configuration - (2)' in 6ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:10.378 AM] Sending request 'textDocument/codeAction - (1)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":17},"end":{"line":16,"character":17}},"context":{"diagnostics":[],"triggerKind":2}}
[Trace - 10:27:10.427 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2023/06/06 10:27:10 go info for /Users/hakim/projects/foo\n(go dir /Users/hakim/projects/foo)\n(go version go version go1.20.3 darwin/amd64)\n(valid build configuration = true)\n(build flags: [])\n(selected go env: [GO111MODULE=, GOCACHE=/Users/hakim/Library/Caches/go-build, GOFLAGS=, GOMODCACHE=/Users/hakim/go/pkg/mod, GOPATH=/Users/hakim/go, GOPRIVATE=, GOROOT=/usr/local/go, GOWORK=])\n\n"}
[Info - 10:27:10 AM] 2023/06/06 10:27:10 go info for /Users/hakim/projects/foo
(go dir /Users/hakim/projects/foo)
(go version go version go1.20.3 darwin/amd64)
(valid build configuration = true)
(build flags: [])
(selected go env: [GO111MODULE=, GOCACHE=/Users/hakim/Library/Caches/go-build, GOFLAGS=, GOMODCACHE=/Users/hakim/go/pkg/mod, GOPATH=/Users/hakim/go, GOPRIVATE=, GOROOT=/usr/local/go, GOWORK=])
[Trace - 10:27:10.500 AM] Sending request 'textDocument/inlayHint - (2)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":0,"character":0},"end":{"line":36,"character":0}}}
[Trace - 10:27:10.501 AM] Sending request 'textDocument/documentLink - (3)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:10.519 AM] Sending notification '$/cancelRequest'.
Params: {"id":3}
[Trace - 10:27:10.658 AM] Sending request 'textDocument/documentLink - (4)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:10.927 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2023/06/06 10:27:10 go/packages.Load #1\n\tsnapshot=0\n\tdirectory=file:///Users/hakim/projects/foo\n\tquery=[/Users/hakim/projects/foo/... builtin]\n\tpackages=2\n"}
[Trace - 10:27:10.931 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2023/06/06 10:27:10 go/packages.Load #1: updating metadata for 48 packages\n"}
[Trace - 10:27:10.956 AM] Received notification '$/progress'.
Params: {"token":"3000518084189521886","value":{"kind":"end","message":"Finished loading packages."}}
[Trace - 10:27:10.958 AM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.{go,mod,sum,work}","kind":7}]}}]}
[Info - 10:27:10 AM] 2023/06/06 10:27:10 go/packages.Load #1
snapshot=0
directory=file:///Users/hakim/projects/foo
query=[/Users/hakim/projects/foo/... builtin]
packages=2
[Info - 10:27:10 AM] 2023/06/06 10:27:10 go/packages.Load #1: updating metadata for 48 packages
[Trace - 10:27:10.969 AM] Sending response 'client/registerCapability - (3)' in 10ms.
Result:
[Trace - 10:27:10.969 AM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]}
[Trace - 10:27:10.973 AM] Sending response 'client/registerCapability - (4)' in 4ms.
Result:
[Trace - 10:27:11.016 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":1,"diagnostics":[{"range":{"start":{"line":4,"character":1},"end":{"line":4,"character":10}},"severity":1,"code":"UnusedImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UnusedImport"},"source":"compiler","message":"\"strings\" imported and not used","tags":[1]},{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undefined: bytes"}]}
[Trace - 10:27:11.098 AM] Sending request 'textDocument/foldingRange - (5)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:11.099 AM] Sending request 'textDocument/codeLens - (6)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:11.388 AM] Sending request 'textDocument/codeAction - (7)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":17},"end":{"line":16,"character":17}},"context":{"diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"message":"undefined: bytes","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"}],"triggerKind":2}}
[Trace - 10:27:11.388 AM] Sending notification '$/cancelRequest'.
Params: {"id":1}
[Error - Received] 10:27:11.388 AM #1 context canceled
[Trace - 10:27:11.388 AM] Received response 'textDocument/inlayHint - (2)' in 888ms.
Result: null
[Error - Received] 10:27:11.389 AM #3 JSON RPC cancelled
[Error - 10:27:11 AM] Request textDocument/codeAction failed.
Message: context canceled
Code: 0
[Trace - 10:27:11.391 AM] Received response 'textDocument/documentLink - (4)' in 732ms.
Result: [{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":15}},"target":"https://pkg.go.dev/encoding/json"},{"range":{"start":{"line":4,"character":2},"end":{"line":4,"character":9}},"target":"https://pkg.go.dev/strings"},{"range":{"start":{"line":5,"character":2},"end":{"line":5,"character":6}},"target":"https://pkg.go.dev/time"},{"range":{"start":{"line":30,"character":25},"end":{"line":30,"character":50}},"target":"https://git.apache.org/thrift.git"},{"range":{"start":{"line":34,"character":23},"end":{"line":34,"character":40}},"target":"https://golang.org/x/text"},{"range":{"start":{"line":35,"character":9},"end":{"line":35,"character":28}},"target":"https://golang.org/x/crypto"}]
[Trace - 10:27:11.392 AM] Received response 'textDocument/foldingRange - (5)' in 293ms.
Result: [{"startLine":2,"startCharacter":8,"endLine":5,"endCharacter":7,"kind":"imports"},{"startLine":8,"startCharacter":26,"endLine":11,"endCharacter":20},{"startLine":14,"startCharacter":13,"endLine":31,"endCharacter":9},{"startLine":15,"startCharacter":59,"endLine":27,"endCharacter":14},{"startLine":18,"startCharacter":18,"endLine":25,"endCharacter":4},{"startLine":20,"startCharacter":41,"endLine":21,"endCharacter":9},{"startLine":23,"startCharacter":42,"endLine":24,"endCharacter":15},{"startLine":34,"startCharacter":13,"endLine":35,"endCharacter":119}]
[Trace - 10:27:11.392 AM] Received response 'textDocument/codeLens - (6)' in 293ms.
Result: null
[Trace - 10:27:11.411 AM] Received response 'textDocument/codeAction - (7)' in 23ms.
Result: [{"title":"Add import: \"bytes\"","kind":"quickfix","diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undefined: bytes"}],"edit":{"documentChanges":[{"textDocument":{"version":1,"uri":"file:///Users/hakim/projects/foo/main.go"},"edits":[{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":8}},"newText":"\n\t\"bytes\""}]}]}},{"title":"Organize Imports","kind":"source.organizeImports","edit":{"documentChanges":[{"textDocument":{"version":1,"uri":"file:///Users/hakim/projects/foo/main.go"},"edits":[{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":2}},"newText":"byt"},{"range":{"start":{"line":3,"character":3},"end":{"line":3,"character":3}},"newText":"s\"\n\t\"e"},{"range":{"start":{"line":3,"character":14},"end":{"line":4,"character":6}},"newText":""},{"range":{"start":{"line":4,"character":7},"end":{"line":4,"character":9}},"newText":""}]}]}}]
[Trace - 10:27:11.478 AM] Sending notification '$/setTrace'.
Params: {"value":"messages"}
[Trace - 10:27:11.478 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":null}
[Trace - 10:27:11.479 AM] Received request 'workspace/configuration - (5)'.
Params: {"items":[{"section":"gopls"}]}
[Trace - 10:27:11.485 AM] Sending response 'workspace/configuration - (5)' in 6ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:11.485 AM] Received request 'workspace/configuration - (6)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/projects/foo","section":"gopls"}]}
[Trace - 10:27:11.490 AM] Sending response 'workspace/configuration - (6)' in 4ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:11.564 AM] Sending notification '$/setTrace'.
Params: {"value":"messages"}
[Trace - 10:27:11.564 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":null}
[Trace - 10:27:11.564 AM] Received request 'workspace/configuration - (7)'.
Params: {"items":[{"section":"gopls"}]}
[Trace - 10:27:11.569 AM] Sending response 'workspace/configuration - (7)' in 4ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:11.569 AM] Received request 'workspace/configuration - (8)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/projects/foo","section":"gopls"}]}
[Trace - 10:27:11.571 AM] Sending response 'workspace/configuration - (8)' in 2ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:12.050 AM] Sending request 'textDocument/documentLink - (8)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:12.050 AM] Sending request 'textDocument/codeAction - (9)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":17},"end":{"line":16,"character":17}},"context":{"diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"message":"undefined: bytes","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"}],"triggerKind":2}}
[Trace - 10:27:12.050 AM] Sending request 'textDocument/documentSymbol - (10)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:12.051 AM] Received response 'textDocument/documentLink - (8)' in 1ms.
Result: [{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":15}},"target":"https://pkg.go.dev/encoding/json"},{"range":{"start":{"line":4,"character":2},"end":{"line":4,"character":9}},"target":"https://pkg.go.dev/strings"},{"range":{"start":{"line":5,"character":2},"end":{"line":5,"character":6}},"target":"https://pkg.go.dev/time"},{"range":{"start":{"line":30,"character":25},"end":{"line":30,"character":50}},"target":"https://git.apache.org/thrift.git"},{"range":{"start":{"line":34,"character":23},"end":{"line":34,"character":40}},"target":"https://golang.org/x/text"},{"range":{"start":{"line":35,"character":9},"end":{"line":35,"character":28}},"target":"https://golang.org/x/crypto"}]
[Trace - 10:27:12.052 AM] Received response 'textDocument/codeAction - (9)' in 2ms.
Result: [{"title":"Add import: \"bytes\"","kind":"quickfix","diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undefined: bytes"}],"edit":{"documentChanges":[{"textDocument":{"version":1,"uri":"file:///Users/hakim/projects/foo/main.go"},"edits":[{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":8}},"newText":"\n\t\"bytes\""}]}]}},{"title":"Organize Imports","kind":"source.organizeImports","edit":{"documentChanges":[{"textDocument":{"version":1,"uri":"file:///Users/hakim/projects/foo/main.go"},"edits":[{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":2}},"newText":"byt"},{"range":{"start":{"line":3,"character":3},"end":{"line":3,"character":3}},"newText":"s\"\n\t\"e"},{"range":{"start":{"line":3,"character":14},"end":{"line":4,"character":6}},"newText":""},{"range":{"start":{"line":4,"character":7},"end":{"line":4,"character":9}},"newText":""}]}]}}]
[Trace - 10:27:12.053 AM] Received response 'textDocument/documentSymbol - (10)' in 2ms.
Result: [{"name":"IndexVersion","detail":"struct{...}","kind":23,"range":{"start":{"line":8,"character":5},"end":{"line":12,"character":1}},"selectionRange":{"start":{"line":8,"character":5},"end":{"line":8,"character":17}},"children":[{"name":"Path","detail":"string","kind":8,"range":{"start":{"line":9,"character":1},"end":{"line":9,"character":17}},"selectionRange":{"start":{"line":9,"character":1},"end":{"line":9,"character":5}}},{"name":"Version","detail":"string","kind":8,"range":{"start":{"line":10,"character":1},"end":{"line":10,"character":17}},"selectionRange":{"start":{"line":10,"character":1},"end":{"line":10,"character":8}}},{"name":"Timestamp","detail":"time.Time","kind":8,"range":{"start":{"line":11,"character":1},"end":{"line":11,"character":20}},"selectionRange":{"start":{"line":11,"character":1},"end":{"line":11,"character":10}}}]},{"name":"main","detail":"func()","kind":12,"range":{"start":{"line":14,"character":0},"end":{"line":32,"character":1}},"selectionRange":{"start":{"line":14,"character":5},"end":{"line":14,"character":9}}},{"name":"data","kind":14,"range":{"start":{"line":34,"character":6},"end":{"line":35,"character":119}},"selectionRange":{"start":{"line":34,"character":6},"end":{"line":34,"character":10}}}]
[Trace - 10:27:12.174 AM] Sending notification '$/setTrace'.
Params: {"value":"messages"}
[Trace - 10:27:12.174 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":null}
[Trace - 10:27:12.175 AM] Received request 'workspace/configuration - (9)'.
Params: {"items":[{"section":"gopls"}]}
[Trace - 10:27:12.185 AM] Sending response 'workspace/configuration - (9)' in 10ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:12.185 AM] Received request 'workspace/configuration - (10)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/projects/foo","section":"gopls"}]}
[Trace - 10:27:12.208 AM] Sending response 'workspace/configuration - (10)' in 22ms.
Result: [{"ui.codelenses":{"run_govulncheck":true},"ui.diagnostic.analyses":{"nilness":true,"infertypeargs":false},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Imports","allExperiments":true}]
[Trace - 10:27:12.464 AM] Sending request 'textDocument/documentLink - (11)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:12.466 AM] Received response 'textDocument/documentLink - (11)' in 1ms.
Result: [{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":15}},"target":"https://pkg.go.dev/encoding/json"},{"range":{"start":{"line":4,"character":2},"end":{"line":4,"character":9}},"target":"https://pkg.go.dev/strings"},{"range":{"start":{"line":5,"character":2},"end":{"line":5,"character":6}},"target":"https://pkg.go.dev/time"},{"range":{"start":{"line":30,"character":25},"end":{"line":30,"character":50}},"target":"https://git.apache.org/thrift.git"},{"range":{"start":{"line":34,"character":23},"end":{"line":34,"character":40}},"target":"https://golang.org/x/text"},{"range":{"start":{"line":35,"character":9},"end":{"line":35,"character":28}},"target":"https://golang.org/x/crypto"}]
[Trace - 10:27:12.537 AM] Sending request 'textDocument/codeLens - (12)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:12.538 AM] Received response 'textDocument/codeLens - (12)' in 0ms.
Result: null
[Trace - 10:27:13.811 AM] Sending request 'textDocument/codeLens - (13)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:13.811 AM] Received response 'textDocument/codeLens - (13)' in 0ms.
Result: null
[Trace - 10:27:19.710 AM] Sending request 'textDocument/documentHighlight - (14)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"position":{"line":16,"character":16}}
[Trace - 10:27:19.710 AM] Received response 'textDocument/documentHighlight - (14)' in 0ms.
Result: [{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"kind":1}]
[Trace - 10:27:20.816 AM] Sending request 'textDocument/codeAction - (15)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"context":{"diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"message":"undefined: bytes","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"}],"triggerKind":2}}
[Trace - 10:27:20.819 AM] Received response 'textDocument/codeAction - (15)' in 3ms.
Result: [{"title":"Add import: \"bytes\"","kind":"quickfix","diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undefined: bytes"}],"edit":{"documentChanges":[{"textDocument":{"version":1,"uri":"file:///Users/hakim/projects/foo/main.go"},"edits":[{"range":{"start":{"line":2,"character":8},"end":{"line":2,"character":8}},"newText":"\n\t\"bytes\""}]}]}},{"title":"Organize Imports","kind":"source.organizeImports","edit":{"documentChanges":[{"textDocument":{"version":1,"uri":"file:///Users/hakim/projects/foo/main.go"},"edits":[{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":2}},"newText":"byt"},{"range":{"start":{"line":3,"character":3},"end":{"line":3,"character":3}},"newText":"s\"\n\t\"e"},{"range":{"start":{"line":3,"character":14},"end":{"line":4,"character":6}},"newText":""},{"range":{"start":{"line":4,"character":7},"end":{"line":4,"character":9}},"newText":""}]}]}}]
[Trace - 10:27:22.465 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":2},"contentChanges":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":17}},"rangeLength":5,"text":""}]}
[Trace - 10:27:22.471 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":2,"diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":12}},"severity":1,"source":"syntax","message":"expected operand, found '.'"}]}
[Trace - 10:27:22.732 AM] Sending request 'textDocument/codeLens - (16)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:22.733 AM] Received response 'textDocument/codeLens - (16)' in 0ms.
Result: null
[Trace - 10:27:22.754 AM] Sending request 'textDocument/codeAction - (17)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":12}},"context":{"diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":12}},"message":"expected operand, found '.'","severity":1,"source":"syntax"}],"triggerKind":2}}
[Trace - 10:27:22.756 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2023/06/06 10:27:22 imports fixes: AllImportsFixes: /Users/hakim/projects/foo/main.go:17:13: expected operand, found '.' (and 1 more errors)\n\tfile=\"/Users/hakim/projects/foo/main.go\"\n"}
[Error - 10:27:22 AM] 2023/06/06 10:27:22 imports fixes: AllImportsFixes: /Users/hakim/projects/foo/main.go:17:13: expected operand, found '.' (and 1 more errors)
file="/Users/hakim/projects/foo/main.go"
[Trace - 10:27:22.759 AM] Received response 'textDocument/codeAction - (17)' in 5ms.
Result: null
[Trace - 10:27:22.840 AM] Sending request 'textDocument/foldingRange - (18)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:22.840 AM] Received response 'textDocument/foldingRange - (18)' in 0ms.
Result: []
[Trace - 10:27:22.959 AM] Sending request 'textDocument/documentSymbol - (19)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:22.960 AM] Received response 'textDocument/documentSymbol - (19)' in 0ms.
Result: [{"name":"IndexVersion","detail":"struct{...}","kind":23,"range":{"start":{"line":8,"character":5},"end":{"line":12,"character":1}},"selectionRange":{"start":{"line":8,"character":5},"end":{"line":8,"character":17}},"children":[{"name":"Path","detail":"string","kind":8,"range":{"start":{"line":9,"character":1},"end":{"line":9,"character":17}},"selectionRange":{"start":{"line":9,"character":1},"end":{"line":9,"character":5}}},{"name":"Version","detail":"string","kind":8,"range":{"start":{"line":10,"character":1},"end":{"line":10,"character":17}},"selectionRange":{"start":{"line":10,"character":1},"end":{"line":10,"character":8}}},{"name":"Timestamp","detail":"time.Time","kind":8,"range":{"start":{"line":11,"character":1},"end":{"line":11,"character":20}},"selectionRange":{"start":{"line":11,"character":1},"end":{"line":11,"character":10}}}]},{"name":"main","detail":"func()","kind":12,"range":{"start":{"line":14,"character":0},"end":{"line":32,"character":1}},"selectionRange":{"start":{"line":14,"character":5},"end":{"line":14,"character":9}}},{"name":"data","kind":14,"range":{"start":{"line":34,"character":6},"end":{"line":35,"character":119}},"selectionRange":{"start":{"line":34,"character":6},"end":{"line":34,"character":10}}}]
[Trace - 10:27:23.474 AM] Sending request 'textDocument/documentLink - (20)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:23.477 AM] Received response 'textDocument/documentLink - (20)' in 3ms.
Result: [{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":15}},"target":"https://pkg.go.dev/encoding/json"},{"range":{"start":{"line":4,"character":2},"end":{"line":4,"character":9}},"target":"https://pkg.go.dev/strings"},{"range":{"start":{"line":5,"character":2},"end":{"line":5,"character":6}},"target":"https://pkg.go.dev/time"},{"range":{"start":{"line":30,"character":25},"end":{"line":30,"character":50}},"target":"https://git.apache.org/thrift.git"},{"range":{"start":{"line":34,"character":23},"end":{"line":34,"character":40}},"target":"https://golang.org/x/text"},{"range":{"start":{"line":35,"character":9},"end":{"line":35,"character":28}},"target":"https://golang.org/x/crypto"}]
[Trace - 10:27:23.721 AM] Sending request 'textDocument/inlayHint - (21)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":0,"character":0},"end":{"line":36,"character":0}}}
[Trace - 10:27:23.721 AM] Received response 'textDocument/inlayHint - (21)' in 0ms.
Result: null
[Trace - 10:27:25.480 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":3},"contentChanges":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":12}},"rangeLength":0,"text":"s"}]}
[Trace - 10:27:25.485 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":3,"diagnostics":[{"range":{"start":{"line":4,"character":1},"end":{"line":4,"character":10}},"severity":1,"code":"UnusedImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UnusedImport"},"source":"compiler","message":"\"strings\" imported and not used","tags":[1]},{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undefined: s"}]}
[Trace - 10:27:25.499 AM] Sending request 'textDocument/completion - (22)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"position":{"line":16,"character":13},"context":{"triggerKind":1}}
[Trace - 10:27:25.504 AM] Received response 'textDocument/completion - (22)' in 4ms.
Result: {"isIncomplete":true,"items":[{"label":"strings","kind":9,"detail":"\"strings\"","documentation":{"kind":"markdown","value":""},"preselect":true,"sortText":"00000","filterText":"strings","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"strings"}},{"label":"sort","kind":9,"detail":"\"sort\"","documentation":{"kind":"markdown","value":""},"sortText":"00001","filterText":"sort","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"sort"},"additionalTextEdits":[{"range":{"start":{"line":3,"character":15},"end":{"line":3,"character":15}},"newText":"\"\n\t\"sort"}]},{"label":"strconv","kind":9,"detail":"\"strconv\"","documentation":{"kind":"markdown","value":""},"sortText":"00002","filterText":"strconv","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"strconv"},"additionalTextEdits":[{"range":{"start":{"line":3,"character":12},"end":{"line":3,"character":12}},"newText":"son\"\n\t\""},{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":13}},"newText":"trc"},{"range":{"start":{"line":3,"character":15},"end":{"line":3,"character":15}},"newText":"v"}]},{"label":"sync","kind":9,"detail":"\"sync\"","documentation":{"kind":"markdown","value":""},"sortText":"00003","filterText":"sync","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"sync"},"additionalTextEdits":[{"range":{"start":{"line":4,"character":8},"end":{"line":4,"character":8}},"newText":"s\"\n\t\""},{"range":{"start":{"line":4,"character":9},"end":{"line":4,"character":9}},"newText":"ync"}]},{"label":"syscall","kind":9,"detail":"\"syscall\"","documentation":{"kind":"markdown","value":""},"sortText":"00004","filterText":"syscall","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"syscall"},"additionalTextEdits":[{"range":{"start":{"line":4,"character":8},"end":{"line":4,"character":8}},"newText":"s\"\n\t\"sy"},{"range":{"start":{"line":4,"character":9},"end":{"line":4,"character":9}},"newText":"call"}]},{"label":"string","kind":7,"documentation":{"kind":"markdown","value":""},"sortText":"00005","filterText":"string","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"string"}},{"label":"safefilepath","kind":9,"detail":"\"internal/safefilepath\"","documentation":{"kind":"markdown","value":""},"sortText":"00006","filterText":"safefilepath","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"safefilepath"},"additionalTextEdits":[{"range":{"start":{"line":3,"character":15},"end":{"line":3,"character":15}},"newText":"\"\n\t\"internal/safefilepath"}]},{"label":"json.SyntaxError","kind":22,"detail":"struct{...}","documentation":{"kind":"markdown","value":"A SyntaxError is a description of a JSON syntax error. Unmarshal will return a SyntaxError if the JSON can't be parsed.\n"},"sortText":"00007","filterText":"json.SyntaxError","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"json.SyntaxError"}},{"label":"strings.Builder","kind":22,"detail":"struct{...}","documentation":{"kind":"markdown","value":"A Builder is used to efficiently build a string using Write methods. It minimizes memory copying. The zero value is ready to use. Do not copy a non-zero Builder.\n"},"sortText":"00008","filterText":"strings.Builder","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"strings.Builder"}},{"label":"strings.Clone","kind":3,"detail":"func(s string) string","documentation":{"kind":"markdown","value":"Clone returns a fresh copy of s. It guarantees to make a copy of s into a new allocation, which can be important when retaining only a small substring of a much larger string. Using Clone can help such programs use less memory. Of course, since using Clone makes a copy, overuse of Clone can make programs use more memory. Clone should typically be used only rarely, and only when profiling indicates that it is needed. For strings of length zero the string \"\" will be returned and no allocation is made.\n"},"sortText":"00009","filterText":"strings.Clone","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"newText":"strings.Clone"}}]}
[Trace - 10:27:25.683 AM] Sending request 'textDocument/foldingRange - (23)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:25.684 AM] Received response 'textDocument/foldingRange - (23)' in 0ms.
Result: [{"startLine":2,"startCharacter":8,"endLine":5,"endCharacter":7,"kind":"imports"},{"startLine":8,"startCharacter":26,"endLine":11,"endCharacter":20},{"startLine":14,"startCharacter":13,"endLine":31,"endCharacter":9},{"startLine":15,"startCharacter":59,"endLine":27,"endCharacter":14},{"startLine":18,"startCharacter":18,"endLine":25,"endCharacter":4},{"startLine":20,"startCharacter":41,"endLine":21,"endCharacter":9},{"startLine":23,"startCharacter":42,"endLine":24,"endCharacter":15},{"startLine":34,"startCharacter":13,"endLine":35,"endCharacter":119}]
[Trace - 10:27:25.735 AM] Sending request 'textDocument/codeLens - (24)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:25.735 AM] Received response 'textDocument/codeLens - (24)' in 0ms.
Result: null
[Trace - 10:27:25.751 AM] Sending request 'textDocument/codeAction - (25)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":13},"end":{"line":16,"character":13}},"context":{"diagnostics":[{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"message":"undefined: s","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"}],"triggerKind":2}}
[Trace - 10:27:25.832 AM] Sending request 'textDocument/documentSymbol - (26)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:25.888 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":4},"contentChanges":[{"range":{"start":{"line":16,"character":13},"end":{"line":16,"character":13}},"rangeLength":0,"text":"t"}]}
[Trace - 10:27:25.892 AM] Sending notification '$/cancelRequest'.
Params: {"id":25}
[Trace - 10:27:25.894 AM] Sending request 'textDocument/completion - (27)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"position":{"line":16,"character":14},"context":{"triggerKind":3}}
[Trace - 10:27:26.090 AM] Sending request 'textDocument/foldingRange - (28)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:26.141 AM] Sending request 'textDocument/codeLens - (29)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:26.142 AM] Sending request 'textDocument/codeAction - (30)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":14},"end":{"line":16,"character":14}},"context":{"diagnostics":[],"triggerKind":2}}
[Trace - 10:27:26.243 AM] Sending notification '$/cancelRequest'.
Params: {"id":26}
[Trace - 10:27:26.243 AM] Sending request 'textDocument/documentSymbol - (31)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:26.266 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":5},"contentChanges":[{"range":{"start":{"line":16,"character":14},"end":{"line":16,"character":14}},"rangeLength":0,"text":"r"}]}
[Trace - 10:27:26.267 AM] Sending notification '$/cancelRequest'.
Params: {"id":30}
[Trace - 10:27:26.267 AM] Sending notification '$/cancelRequest'.
Params: {"id":28}
[Trace - 10:27:26.463 AM] Sending request 'textDocument/foldingRange - (32)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:26.517 AM] Sending notification '$/cancelRequest'.
Params: {"id":29}
[Trace - 10:27:26.517 AM] Sending request 'textDocument/codeLens - (33)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:26.517 AM] Sending request 'textDocument/codeAction - (34)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":15},"end":{"line":16,"character":15}},"context":{"diagnostics":[],"triggerKind":2}}
[Trace - 10:27:26.609 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":6},"contentChanges":[{"range":{"start":{"line":16,"character":15},"end":{"line":16,"character":15}},"rangeLength":0,"text":"i"}]}
[Trace - 10:27:26.611 AM] Sending notification '$/cancelRequest'.
Params: {"id":34}
[Trace - 10:27:26.615 AM] Sending notification '$/cancelRequest'.
Params: {"id":32}
[Trace - 10:27:26.817 AM] Sending request 'textDocument/foldingRange - (35)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:26.904 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":7},"contentChanges":[{"range":{"start":{"line":16,"character":16},"end":{"line":16,"character":16}},"rangeLength":0,"text":"n"}]}
[Trace - 10:27:26.908 AM] Sending notification '$/cancelRequest'.
Params: {"id":35}
[Trace - 10:27:27.136 AM] Sending request 'textDocument/foldingRange - (36)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:27.154 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":8},"contentChanges":[{"range":{"start":{"line":16,"character":17},"end":{"line":16,"character":17}},"rangeLength":0,"text":"g"}]}
[Trace - 10:27:27.161 AM] Sending notification '$/cancelRequest'.
Params: {"id":36}
[Trace - 10:27:27.413 AM] Sending request 'textDocument/foldingRange - (37)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:27.415 AM] Sending notification '$/cancelRequest'.
Params: {"id":33}
[Trace - 10:27:27.416 AM] Sending request 'textDocument/codeLens - (38)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:27.418 AM] Sending request 'textDocument/codeAction - (39)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":18},"end":{"line":16,"character":18}},"context":{"diagnostics":[],"triggerKind":2}}
[Trace - 10:27:27.568 AM] Sending notification 'textDocument/didChange'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go","version":9},"contentChanges":[{"range":{"start":{"line":16,"character":18},"end":{"line":16,"character":18}},"rangeLength":0,"text":"s"}]}
[Trace - 10:27:27.570 AM] Sending notification '$/cancelRequest'.
Params: {"id":39}
[Trace - 10:27:27.573 AM] Sending notification '$/cancelRequest'.
Params: {"id":37}
[Trace - 10:27:27.772 AM] Sending request 'textDocument/foldingRange - (40)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:27.830 AM] Sending notification '$/cancelRequest'.
Params: {"id":38}
[Trace - 10:27:27.833 AM] Sending request 'textDocument/codeLens - (41)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:27.843 AM] Sending request 'textDocument/codeAction - (42)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":16,"character":19},"end":{"line":16,"character":19}},"context":{"diagnostics":[],"triggerKind":2}}
[Trace - 10:27:27.983 AM] Sending notification '$/cancelRequest'.
Params: {"id":31}
[Trace - 10:27:27.988 AM] Sending request 'textDocument/documentSymbol - (43)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:28.577 AM] Sending request 'textDocument/documentLink - (44)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
[Trace - 10:27:28.828 AM] Sending request 'textDocument/inlayHint - (45)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":0,"character":0},"end":{"line":36,"character":0}}}
[Trace - 10:27:30.682 AM] Sending request 'textDocument/codeAction - (46)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"range":{"start":{"line":0,"character":0},"end":{"line":36,"character":0}},"context":{"diagnostics":[{"range":{"start":{"line":4,"character":1},"end":{"line":4,"character":10}},"message":"\"strings\" imported and not used","code":"UnusedImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UnusedImport"},"severity":1,"tags":[1],"source":"compiler"},{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":13}},"message":"undefined: s","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"}],"only":["source.organizeImports"],"triggerKind":2}}
[Error - Received] 10:27:42.430 AM #25 context canceled
[Error - Received] 10:27:42.430 AM #26 JSON RPC cancelled
[Trace - 10:27:42.430 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2023/06/06 10:27:42 background imports cache refresh starting\n"}
[Error - 10:27:42 AM] Request textDocument/codeAction failed.
Message: context canceled
Code: 0
[Trace - 10:27:42.438 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":4,"diagnostics":[{"range":{"start":{"line":4,"character":1},"end":{"line":4,"character":10}},"severity":1,"code":"UnusedImport","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UnusedImport"},"source":"compiler","message":"\"strings\" imported and not used","tags":[1]},{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"severity":1,"code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"source":"compiler","message":"undefined: st"}]}
[Info - 10:27:42 AM] 2023/06/06 10:27:42 background imports cache refresh starting
[Trace - 10:27:42.533 AM] Received response 'textDocument/completion - (27)' in 16639ms.
Result: {"isIncomplete":true,"items":[{"label":"strings","kind":9,"detail":"\"strings\"","documentation":{"kind":"markdown","value":""},"preselect":true,"sortText":"00000","filterText":"strings","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"strings"}},{"label":"strconv","kind":9,"detail":"\"strconv\"","documentation":{"kind":"markdown","value":""},"sortText":"00001","filterText":"strconv","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"strconv"},"additionalTextEdits":[{"range":{"start":{"line":3,"character":12},"end":{"line":3,"character":12}},"newText":"son\"\n\t\""},{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":13}},"newText":"trc"},{"range":{"start":{"line":3,"character":15},"end":{"line":3,"character":15}},"newText":"v"}]},{"label":"string","kind":7,"documentation":{"kind":"markdown","value":""},"sortText":"00002","filterText":"string","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"string"}},{"label":"strings.Title","kind":3,"detail":"func(s string) string","documentation":{"kind":"markdown","value":"Title returns a copy of the string s with all Unicode letters that begin words mapped to their Unicode title case.\n\nDeprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.\n"},"sortText":"00003","filterText":"strings.Title","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"strings.Title"}},{"label":"strings.ToLower","kind":3,"detail":"func(s string) string","documentation":{"kind":"markdown","value":"ToLower returns s with all Unicode letters mapped to their lower case.\n"},"sortText":"00004","filterText":"strings.ToLower","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"strings.ToLower"}},{"label":"strings.ToLowerSpecial","kind":3,"detail":"func(c unicode.SpecialCase, s string) string","documentation":{"kind":"markdown","value":"ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their lower case using the case mapping specified by c.\n"},"sortText":"00005","filterText":"strings.ToLowerSpecial","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"strings.ToLowerSpecial"}},{"label":"storageapi","kind":9,"detail":"\"github.com/Azure/azure-sdk-for-go/profiles/2019-03-01/storage/mgmt/storage/storageapi\"","documentation":{"kind":"markdown","value":""},"sortText":"00006","filterText":"storageapi","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"storageapi"},"additionalTextEdits":[{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":0}},"newText":"\n\t\"github.com/Azure/azure-sdk-for-go/profiles/2019-03-01/storage/mgmt/storage/storageapi\"\n"}]},{"label":"storagecacheapi","kind":9,"detail":"\"github.com/Azure/azure-sdk-for-go/services/preview/storagecache/mgmt/2019-08-01-preview/storagecache/storagecacheapi\"","documentation":{"kind":"markdown","value":""},"sortText":"00007","filterText":"storagecacheapi","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"storagecacheapi"},"additionalTextEdits":[{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":0}},"newText":"\n\t\"github.com/Azure/azure-sdk-for-go/services/preview/storagecache/mgmt/2019-08-01-preview/storagecache/storagecacheapi\"\n"}]},{"label":"storagesync","kind":9,"detail":"\"github.com/Azure/azure-sdk-for-go/profiles/latest/storagesync/mgmt/storagesync\"","documentation":{"kind":"markdown","value":""},"sortText":"00008","filterText":"storagesync","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"storagesync"},"additionalTextEdits":[{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":0}},"newText":"\n\t\"github.com/Azure/azure-sdk-for-go/profiles/latest/storagesync/mgmt/storagesync\"\n"}]},{"label":"storsimpleapi","kind":9,"detail":"\"github.com/Azure/azure-sdk-for-go/services/storsimple8000series/mgmt/2017-06-01/storsimple/storsimpleapi\"","documentation":{"kind":"markdown","value":""},"sortText":"00009","filterText":"storsimpleapi","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":14}},"newText":"storsimpleapi"},"additionalTextEdits":[{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":0}},"newText":"\n\t\"github.com/Azure/azure-sdk-for-go/services/storsimple8000series/mgmt/2017-06-01/storsimple/storsimpleapi\"\n"}]}]}
[Error - Received] 10:27:42.533 AM #28 JSON RPC cancelled
[Error - Received] 10:27:42.533 AM #30 JSON RPC cancelled
[Error - Received] 10:27:42.533 AM #31 JSON RPC cancelled
[Error - Received] 10:27:42.533 AM #29 JSON RPC cancelled
[Error - Received] 10:27:42.534 AM #32 JSON RPC cancelled
[Error - Received] 10:27:42.534 AM #34 JSON RPC cancelled
[Error - Received] 10:27:42.534 AM #33 JSON RPC cancelled
[Error - Received] 10:27:42.535 AM #35 JSON RPC cancelled
[Trace - 10:27:42.535 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":5,"diagnostics":[]}
[Error - Received] 10:27:42.536 AM #37 JSON RPC cancelled
[Error - Received] 10:27:42.537 AM #36 JSON RPC cancelled
[Error - Received] 10:27:42.537 AM #38 JSON RPC cancelled
[Trace - 10:27:42.537 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":7,"diagnostics":[]}
[Error - Received] 10:27:42.537 AM #39 JSON RPC cancelled
[Trace - 10:27:42.538 AM] Received response 'textDocument/foldingRange - (40)' in 14765ms.
Result: [{"startLine":2,"startCharacter":8,"endLine":5,"endCharacter":7,"kind":"imports"},{"startLine":8,"startCharacter":26,"endLine":11,"endCharacter":20},{"startLine":14,"startCharacter":13,"endLine":31,"endCharacter":9},{"startLine":15,"startCharacter":59,"endLine":27,"endCharacter":14},{"startLine":18,"startCharacter":18,"endLine":25,"endCharacter":4},{"startLine":20,"startCharacter":41,"endLine":21,"endCharacter":9},{"startLine":23,"startCharacter":42,"endLine":24,"endCharacter":15},{"startLine":34,"startCharacter":13,"endLine":35,"endCharacter":119}]
[Trace - 10:27:42.538 AM] Received response 'textDocument/codeLens - (41)' in 14705ms.
Result: null
[Trace - 10:27:42.543 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/projects/foo/main.go","version":9,"diagnostics":[]}
[Trace - 10:27:42.546 AM] Received response 'textDocument/codeAction - (42)' in 14702ms.
Result: null
[Trace - 10:27:42.546 AM] Received response 'textDocument/documentSymbol - (43)' in 14558ms.
Result: [{"name":"IndexVersion","detail":"struct{...}","kind":23,"range":{"start":{"line":8,"character":5},"end":{"line":12,"character":1}},"selectionRange":{"start":{"line":8,"character":5},"end":{"line":8,"character":17}},"children":[{"name":"Path","detail":"string","kind":8,"range":{"start":{"line":9,"character":1},"end":{"line":9,"character":17}},"selectionRange":{"start":{"line":9,"character":1},"end":{"line":9,"character":5}}},{"name":"Version","detail":"string","kind":8,"range":{"start":{"line":10,"character":1},"end":{"line":10,"character":17}},"selectionRange":{"start":{"line":10,"character":1},"end":{"line":10,"character":8}}},{"name":"Timestamp","detail":"time.Time","kind":8,"range":{"start":{"line":11,"character":1},"end":{"line":11,"character":20}},"selectionRange":{"start":{"line":11,"character":1},"end":{"line":11,"character":10}}}]},{"name":"main","detail":"func()","kind":12,"range":{"start":{"line":14,"character":0},"end":{"line":32,"character":1}},"selectionRange":{"start":{"line":14,"character":5},"end":{"line":14,"character":9}}},{"name":"data","kind":14,"range":{"start":{"line":34,"character":6},"end":{"line":35,"character":119}},"selectionRange":{"start":{"line":34,"character":6},"end":{"line":34,"character":10}}}]
[Trace - 10:27:42.548 AM] Received response 'textDocument/documentLink - (44)' in 13971ms.
Result: [{"range":{"start":{"line":3,"character":2},"end":{"line":3,"character":15}},"target":"https://pkg.go.dev/encoding/json"},{"range":{"start":{"line":4,"character":2},"end":{"line":4,"character":9}},"target":"https://pkg.go.dev/strings"},{"range":{"start":{"line":5,"character":2},"end":{"line":5,"character":6}},"target":"https://pkg.go.dev/time"},{"range":{"start":{"line":30,"character":25},"end":{"line":30,"character":50}},"target":"https://git.apache.org/thrift.git"},{"range":{"start":{"line":34,"character":23},"end":{"line":34,"character":40}},"target":"https://golang.org/x/text"},{"range":{"start":{"line":35,"character":9},"end":{"line":35,"character":28}},"target":"https://golang.org/x/crypto"}]
[Trace - 10:27:42.548 AM] Received response 'textDocument/inlayHint - (45)' in 13720ms.
Result: null
[Trace - 10:27:42.549 AM] Received response 'textDocument/codeAction - (46)' in 11867ms.
Result: null
[Trace - 10:27:42.572 AM] Sending request 'textDocument/completion - (47)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"position":{"line":16,"character":19},"context":{"triggerKind":3}}
[Trace - 10:27:42.611 AM] Sending request 'textDocument/formatting - (48)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"},"options":{"tabSize":4,"insertSpaces":false}}
[Trace - 10:27:42.674 AM] Received response 'textDocument/completion - (47)' in 101ms.
Result: {"isIncomplete":true,"items":[{"label":"strings","kind":9,"detail":"\"strings\"","documentation":{"kind":"markdown","value":""},"preselect":true,"sortText":"00000","filterText":"strings","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":19}},"newText":"strings"}},{"label":"strings.Split","kind":3,"detail":"func(s string, sep string) []string","documentation":{"kind":"markdown","value":"Split slices s into all substrings separated by sep and returns a slice of the substrings between those separators.\n\nIf s does not contain sep and sep is not empty, Split returns a slice of length 1 whose only element is s.\n\nIf sep is empty, Split splits after each UTF-8 sequence. If both s and sep are empty, Split returns an empty slice.\n\nIt is equivalent to SplitN with a count of -1.\n\nTo split around the first instance of a separator, see Cut.\n"},"sortText":"00001","filterText":"strings.Split","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":19}},"newText":"strings.Split"}},{"label":"strings.SplitAfter","kind":3,"detail":"func(s string, sep string) []string","documentation":{"kind":"markdown","value":"SplitAfter slices s into all substrings after each instance of sep and returns a slice of those substrings.\n\nIf s does not contain sep and sep is not empty, SplitAfter returns a slice of length 1 whose only element is s.\n\nIf sep is empty, SplitAfter splits after each UTF-8 sequence. If both s and sep are empty, SplitAfter returns an empty slice.\n\nIt is equivalent to SplitAfterN with a count of -1.\n"},"sortText":"00002","filterText":"strings.SplitAfter","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":19}},"newText":"strings.SplitAfter"}},{"label":"strings.SplitAfterN","kind":3,"detail":"func(s string, sep string, n int) []string","documentation":{"kind":"markdown","value":"SplitAfterN slices s into substrings after each instance of sep and returns a slice of those substrings.\n\nThe count determines the number of substrings to return:\n\n\tn \u003e 0: at most n substrings; the last substring will be the unsplit remainder.\n\tn == 0: the result is nil (zero substrings)\n\tn \u003c 0: all substrings\n\nEdge cases for s and sep (for example, empty strings) are handled as described in the documentation for SplitAfter.\n"},"sortText":"00003","filterText":"strings.SplitAfterN","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":19}},"newText":"strings.SplitAfterN"}},{"label":"stringslice","kind":9,"detail":"\"github.com/hashicorp/consul/lib/stringslice\"","documentation":{"kind":"markdown","value":""},"sortText":"00004","filterText":"stringslice","insertTextFormat":2,"textEdit":{"range":{"start":{"line":16,"character":12},"end":{"line":16,"character":19}},"newText":"stringslice"},"additionalTextEdits":[{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":0}},"newText":"\n\t\"github.com/hashicorp/consul/lib/stringslice\"\n"}]}]}
[Trace - 10:27:42.675 AM] Received response 'textDocument/formatting - (48)' in 64ms.
Result: []
[Trace - 10:27:42.808 AM] Sending notification 'textDocument/didSave'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/foo/main.go"}}
The text was updated successfully, but these errors were encountered:
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
Jun 6, 2023
I can't reproduce this either. The line/col in the log seems to indicate a completion of the package name "strings", and this operation got stuck for 16.6s, which I guess is why Rob suspects goimports.
Gopls stats
What did you do?
Fixed the following broken code by replacing
bytes.NewReader
withstrings.NewReader
and then and triggered file save (so code action)What did you expect to see?
Code action response with high latency. (VS Code shows the notorious "Saving "main.go": Getting Code Action From Go..." popup)
What did you see instead?
Editor and settings
VS Code Go Nightly
vscode settings:
Logs
I manually triggered file save which corresponds to message
seq 46
. Note that there were diagnostics and completion requests queued up due to my file edits (deletebytes
and typestrings
) before file save.The text was updated successfully, but these errors were encountered: