Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

x/tools/gopls: incorrect document outline for structs #46958

Closed
RaymondNY opened this issue Jun 25, 2021 · 4 comments
Closed

x/tools/gopls: incorrect document outline for structs #46958

RaymondNY opened this issue Jun 25, 2021 · 4 comments
Labels
Documentation gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@RaymondNY
Copy link

VS Code Version: 1.57.1
OS Version: win10
Reproduce:
image
image

Some struct, func should be visible in the outline.Only one extension is go

@hyangah
Copy link
Contributor

hyangah commented Jun 25, 2021

@RaymondNY thanks for the report. That's really strange!

@stamblerre @findleyr I could reproduce this too.

Repro: open a project that imports context package. Follow definition and open the context package's context.go.

gopls trace
[Trace - 19:41:45.889 PM] Sending request 'initialize - (0)'.
Params: {"processId":64477,"clientInfo":{"name":"Visual Studio Code","version":"1.57.1"},"locale":"en-us","rootPath":"/Users/hakim/projects/google/tools","rootUri":"file:///Users/hakim/projects/google/tools","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":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]}},"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]}},"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":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":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},"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"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"initializationOptions":{"build.experimentalWorkspaceModule":true,"allExperiments":true},"trace":"off","workspaceFolders":[{"uri":"file:///Users/hakim/projects/google/tools","name":"tools"}]}


[Trace - 19:41:45.891 PM] Received response 'initialize - (0)' in 1ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."],"completionItem":{}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.rewrite","source.fixAll","source.organizeImports"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.apply_fix","gopls.check_upgrades","gopls.gc_details","gopls.generate","gopls.generate_gopls_mod","gopls.go_get_package","gopls.list_known_packages","gopls.regenerate_cgo","gopls.remove_dependency","gopls.run_tests","gopls.start_debugging","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.workspace_metadata"]},"callHierarchyProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"path\":\"golang.org/x/tools/gopls\",\"version\":\"v0.7.0\",\"sum\":\"h1:JQBHW81Gsyim6iDjUwGoPeSpXrSqwen3isPJLfDfaYU=\",\"deps\":[{\"path\":\"github.com/BurntSushi/toml\",\"version\":\"v0.3.1\",\"sum\":\"h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\"},{\"path\":\"github.com/google/go-cmp\",\"version\":\"v0.5.5\",\"sum\":\"h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=\"},{\"path\":\"github.com/sergi/go-diff\",\"version\":\"v1.1.0\",\"sum\":\"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\"},{\"path\":\"golang.org/x/mod\",\"version\":\"v0.4.2\",\"sum\":\"h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=\"},{\"path\":\"golang.org/x/sync\",\"version\":\"v0.0.0-20210220032951-036812b2e83c\",\"sum\":\"h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=\"},{\"path\":\"golang.org/x/sys\",\"version\":\"v0.0.0-20210510120138-977fb7262007\",\"sum\":\"h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=\"},{\"path\":\"golang.org/x/tools\",\"version\":\"v0.1.3-0.20210608163600-9ed039809d4c\",\"sum\":\"h1:Pv9gNyJFYVdpUAVZYJ1BDSU4eGgXQ+0f3DIGAdolO5s=\"},{\"path\":\"golang.org/x/xerrors\",\"version\":\"v0.0.0-20200804184101-5ec99f83aff1\",\"sum\":\"h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\"},{\"path\":\"honnef.co/go/tools\",\"version\":\"v0.2.0\",\"sum\":\"h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=\"},{\"path\":\"mvdan.cc/gofumpt\",\"version\":\"v0.1.1\",\"sum\":\"h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=\"},{\"path\":\"mvdan.cc/xurls/v2\",\"version\":\"v2.2.0\",\"sum\":\"h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=\"}]}"}}


[Trace - 19:41:45.945 PM] Sending notification 'initialized'.
Params: {}


[Trace - 19:41:45.945 PM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"5577006791947779410"}


[Trace - 19:41:45.959 PM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go","languageId":"go","version":1,"text":"// Copyright 2014 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// Package context defines the Context type, which carries deadlines,\n// cancellation signals, and other request-scoped values across API boundaries\n// and between processes.\n//\n// Incoming requests to a server should create a Context, and outgoing\n// calls to servers should accept a Context. The chain of function\n// calls between them must propagate the Context, optionally replacing\n// it with a derived Context created using WithCancel, WithDeadline,\n// WithTimeout, or WithValue. When a Context is canceled, all\n// Contexts derived from it are also canceled.\n//\n// The WithCancel, WithDeadline, and WithTimeout functions take a\n// Context (the parent) and return a derived Context (the child) and a\n// CancelFunc. Calling the CancelFunc cancels the child and its\n// children, removes the parent's reference to the child, and stops\n// any associated timers. Failing to call the CancelFunc leaks the\n// child and its children until the parent is canceled or the timer\n// fires. The go vet tool checks that CancelFuncs are used on all\n// control-flow paths.\n//\n// Programs that use Contexts should follow these rules to keep interfaces\n// consistent across packages and enable static analysis tools to check context\n// propagation:\n//\n// Do not store Contexts inside a struct type; instead, pass a Context\n// explicitly to each function that needs it. The Context should be the first\n// parameter, typically named ctx:\n//\n// \tfunc DoSomething(ctx context.Context, arg Arg) error {\n// \t\t// ... use ctx ...\n// \t}\n//\n// Do not pass a nil Context, even if a function permits it. Pass context.TODO\n// if you are unsure about which Context to use.\n//\n// Use context Values only for request-scoped data that transits processes and\n// APIs, not for passing optional parameters to functions.\n//\n// The same Context may be passed to functions running in different goroutines;\n// Contexts are safe for simultaneous use by multiple goroutines.\n//\n// See https://blog.golang.org/context for example code for a server that uses\n// Contexts.\npackage context\n\nimport (\n\t\"errors\"\n\t\"internal/reflectlite\"\n\t\"sync\"\n\t\"sync/atomic\"\n\t\"time\"\n)\n\n// A Context carries a deadline, a cancellation signal, and other values across\n// API boundaries.\n//\n// Context's methods may be called by multiple goroutines simultaneously.\ntype Context interface {\n\t// Deadline returns the time when work done on behalf of this context\n\t// should be canceled. Deadline returns ok==false when no deadline is\n\t// set. Successive calls to Deadline return the same results.\n\tDeadline() (deadline time.Time, ok bool)\n\n\t// Done returns a channel that's closed when work done on behalf of this\n\t// context should be canceled. Done may return nil if this context can\n\t// never be canceled. Successive calls to Done return the same value.\n\t// The close of the Done channel may happen asynchronously,\n\t// after the cancel function returns.\n\t//\n\t// WithCancel arranges for Done to be closed when cancel is called;\n\t// WithDeadline arranges for Done to be closed when the deadline\n\t// expires; WithTimeout arranges for Done to be closed when the timeout\n\t// elapses.\n\t//\n\t// Done is provided for use in select statements:\n\t//\n\t//  // Stream generates values with DoSomething and sends them to out\n\t//  // until DoSomething returns an error or ctx.Done is closed.\n\t//  func Stream(ctx context.Context, out chan<- Value) error {\n\t//  \tfor {\n\t//  \t\tv, err := DoSomething(ctx)\n\t//  \t\tif err != nil {\n\t//  \t\t\treturn err\n\t//  \t\t}\n\t//  \t\tselect {\n\t//  \t\tcase <-ctx.Done():\n\t//  \t\t\treturn ctx.Err()\n\t//  \t\tcase out <- v:\n\t//  \t\t}\n\t//  \t}\n\t//  }\n\t//\n\t// See https://blog.golang.org/pipelines for more examples of how to use\n\t// a Done channel for cancellation.\n\tDone() <-chan struct{}\n\n\t// If Done is not yet closed, Err returns nil.\n\t// If Done is closed, Err returns a non-nil error explaining why:\n\t// Canceled if the context was canceled\n\t// or DeadlineExceeded if the context's deadline passed.\n\t// After Err returns a non-nil error, successive calls to Err return the same error.\n\tErr() error\n\n\t// Value returns the value associated with this context for key, or nil\n\t// if no value is associated with key. Successive calls to Value with\n\t// the same key returns the same result.\n\t//\n\t// Use context values only for request-scoped data that transits\n\t// processes and API boundaries, not for passing optional parameters to\n\t// functions.\n\t//\n\t// A key identifies a specific value in a Context. Functions that wish\n\t// to store values in Context typically allocate a key in a global\n\t// variable then use that key as the argument to context.WithValue and\n\t// Context.Value. A key can be any type that supports equality;\n\t// packages should define keys as an unexported type to avoid\n\t// collisions.\n\t//\n\t// Packages that define a Context key should provide type-safe accessors\n\t// for the values stored using that key:\n\t//\n\t// \t// Package user defines a User type that's stored in Contexts.\n\t// \tpackage user\n\t//\n\t// \timport \"context\"\n\t//\n\t// \t// User is the type of value stored in the Contexts.\n\t// \ttype User struct {...}\n\t//\n\t// \t// key is an unexported type for keys defined in this package.\n\t// \t// This prevents collisions with keys defined in other packages.\n\t// \ttype key int\n\t//\n\t// \t// userKey is the key for user.User values in Contexts. It is\n\t// \t// unexported; clients use user.NewContext and user.FromContext\n\t// \t// instead of using this key directly.\n\t// \tvar userKey key\n\t//\n\t// \t// NewContext returns a new Context that carries value u.\n\t// \tfunc NewContext(ctx context.Context, u *User) context.Context {\n\t// \t\treturn context.WithValue(ctx, userKey, u)\n\t// \t}\n\t//\n\t// \t// FromContext returns the User value stored in ctx, if any.\n\t// \tfunc FromContext(ctx context.Context) (*User, bool) {\n\t// \t\tu, ok := ctx.Value(userKey).(*User)\n\t// \t\treturn u, ok\n\t// \t}\n\tValue(key interface{}) interface{}\n}\n\n// Canceled is the error returned by Context.Err when the context is canceled.\nvar Canceled = errors.New(\"context canceled\")\n\n// DeadlineExceeded is the error returned by Context.Err when the context's\n// deadline passes.\nvar DeadlineExceeded error = deadlineExceededError{}\n\ntype deadlineExceededError struct{}\n\nfunc (deadlineExceededError) Error() string   { return \"context deadline exceeded\" }\nfunc (deadlineExceededError) Timeout() bool   { return true }\nfunc (deadlineExceededError) Temporary() bool { return true }\n\n// An emptyCtx is never canceled, has no values, and has no deadline. It is not\n// struct{}, since vars of this type must have distinct addresses.\ntype emptyCtx int\n\nfunc (*emptyCtx) Deadline() (deadline time.Time, ok bool) {\n\treturn\n}\n\nfunc (*emptyCtx) Done() <-chan struct{} {\n\treturn nil\n}\n\nfunc (*emptyCtx) Err() error {\n\treturn nil\n}\n\nfunc (*emptyCtx) Value(key interface{}) interface{} {\n\treturn nil\n}\n\nfunc (e *emptyCtx) String() string {\n\tswitch e {\n\tcase background:\n\t\treturn \"context.Background\"\n\tcase todo:\n\t\treturn \"context.TODO\"\n\t}\n\treturn \"unknown empty Context\"\n}\n\nvar (\n\tbackground = new(emptyCtx)\n\ttodo       = new(emptyCtx)\n)\n\n// Background returns a non-nil, empty Context. It is never canceled, has no\n// values, and has no deadline. It is typically used by the main function,\n// initialization, and tests, and as the top-level Context for incoming\n// requests.\nfunc Background() Context {\n\treturn background\n}\n\n// TODO returns a non-nil, empty Context. Code should use context.TODO when\n// it's unclear which Context to use or it is not yet available (because the\n// surrounding function has not yet been extended to accept a Context\n// parameter).\nfunc TODO() Context {\n\treturn todo\n}\n\n// A CancelFunc tells an operation to abandon its work.\n// A CancelFunc does not wait for the work to stop.\n// A CancelFunc may be called by multiple goroutines simultaneously.\n// After the first call, subsequent calls to a CancelFunc do nothing.\ntype CancelFunc func()\n\n// WithCancel returns a copy of parent with a new Done channel. The returned\n// context's Done channel is closed when the returned cancel function is called\n// or when the parent context's Done channel is closed, whichever happens first.\n//\n// Canceling this context releases resources associated with it, so code should\n// call cancel as soon as the operations running in this Context complete.\nfunc WithCancel(parent Context) (ctx Context, cancel CancelFunc) {\n\tif parent == nil {\n\t\tpanic(\"cannot create context from nil parent\")\n\t}\n\tc := newCancelCtx(parent)\n\tpropagateCancel(parent, &c)\n\treturn &c, func() { c.cancel(true, Canceled) }\n}\n\n// newCancelCtx returns an initialized cancelCtx.\nfunc newCancelCtx(parent Context) cancelCtx {\n\treturn cancelCtx{Context: parent}\n}\n\n// goroutines counts the number of goroutines ever created; for testing.\nvar goroutines int32\n\n// propagateCancel arranges for child to be canceled when parent is.\nfunc propagateCancel(parent Context, child canceler) {\n\tdone := parent.Done()\n\tif done == nil {\n\t\treturn // parent is never canceled\n\t}\n\n\tselect {\n\tcase <-done:\n\t\t// parent is already canceled\n\t\tchild.cancel(false, parent.Err())\n\t\treturn\n\tdefault:\n\t}\n\n\tif p, ok := parentCancelCtx(parent); ok {\n\t\tp.mu.Lock()\n\t\tif p.err != nil {\n\t\t\t// parent has already been canceled\n\t\t\tchild.cancel(false, p.err)\n\t\t} else {\n\t\t\tif p.children == nil {\n\t\t\t\tp.children = make(map[canceler]struct{})\n\t\t\t}\n\t\t\tp.children[child] = struct{}{}\n\t\t}\n\t\tp.mu.Unlock()\n\t} else {\n\t\tatomic.AddInt32(&goroutines, +1)\n\t\tgo func() {\n\t\t\tselect {\n\t\t\tcase <-parent.Done():\n\t\t\t\tchild.cancel(false, parent.Err())\n\t\t\tcase <-child.Done():\n\t\t\t}\n\t\t}()\n\t}\n}\n\n// &cancelCtxKey is the key that a cancelCtx returns itself for.\nvar cancelCtxKey int\n\n// parentCancelCtx returns the underlying *cancelCtx for parent.\n// It does this by looking up parent.Value(&cancelCtxKey) to find\n// the innermost enclosing *cancelCtx and then checking whether\n// parent.Done() matches that *cancelCtx. (If not, the *cancelCtx\n// has been wrapped in a custom implementation providing a\n// different done channel, in which case we should not bypass it.)\nfunc parentCancelCtx(parent Context) (*cancelCtx, bool) {\n\tdone := parent.Done()\n\tif done == closedchan || done == nil {\n\t\treturn nil, false\n\t}\n\tp, ok := parent.Value(&cancelCtxKey).(*cancelCtx)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\tp.mu.Lock()\n\tok = p.done == done\n\tp.mu.Unlock()\n\tif !ok {\n\t\treturn nil, false\n\t}\n\treturn p, true\n}\n\n// removeChild removes a context from its parent.\nfunc removeChild(parent Context, child canceler) {\n\tp, ok := parentCancelCtx(parent)\n\tif !ok {\n\t\treturn\n\t}\n\tp.mu.Lock()\n\tif p.children != nil {\n\t\tdelete(p.children, child)\n\t}\n\tp.mu.Unlock()\n}\n\n// A canceler is a context type that can be canceled directly. The\n// implementations are *cancelCtx and *timerCtx.\ntype canceler interface {\n\tcancel(removeFromParent bool, err error)\n\tDone() <-chan struct{}\n}\n\n// closedchan is a reusable closed channel.\nvar closedchan = make(chan struct{})\n\nfunc init() {\n\tclose(closedchan)\n}\n\n// A cancelCtx can be canceled. When canceled, it also cancels any children\n// that implement canceler.\ntype cancelCtx struct {\n\tContext\n\n\tmu       sync.Mutex            // protects following fields\n\tdone     chan struct{}         // created lazily, closed by first cancel call\n\tchildren map[canceler]struct{} // set to nil by the first cancel call\n\terr      error                 // set to non-nil by the first cancel call\n}\n\nfunc (c *cancelCtx) Value(key interface{}) interface{} {\n\tif key == &cancelCtxKey {\n\t\treturn c\n\t}\n\treturn c.Context.Value(key)\n}\n\nfunc (c *cancelCtx) Done() <-chan struct{} {\n\tc.mu.Lock()\n\tif c.done == nil {\n\t\tc.done = make(chan struct{})\n\t}\n\td := c.done\n\tc.mu.Unlock()\n\treturn d\n}\n\nfunc (c *cancelCtx) Err() error {\n\tc.mu.Lock()\n\terr := c.err\n\tc.mu.Unlock()\n\treturn err\n}\n\ntype stringer interface {\n\tString() string\n}\n\nfunc contextName(c Context) string {\n\tif s, ok := c.(stringer); ok {\n\t\treturn s.String()\n\t}\n\treturn reflectlite.TypeOf(c).String()\n}\n\nfunc (c *cancelCtx) String() string {\n\treturn contextName(c.Context) + \".WithCancel\"\n}\n\n// cancel closes c.done, cancels each of c's children, and, if\n// removeFromParent is true, removes c from its parent's children.\nfunc (c *cancelCtx) cancel(removeFromParent bool, err error) {\n\tif err == nil {\n\t\tpanic(\"context: internal error: missing cancel error\")\n\t}\n\tc.mu.Lock()\n\tif c.err != nil {\n\t\tc.mu.Unlock()\n\t\treturn // already canceled\n\t}\n\tc.err = err\n\tif c.done == nil {\n\t\tc.done = closedchan\n\t} else {\n\t\tclose(c.done)\n\t}\n\tfor child := range c.children {\n\t\t// NOTE: acquiring the child's lock while holding parent's lock.\n\t\tchild.cancel(false, err)\n\t}\n\tc.children = nil\n\tc.mu.Unlock()\n\n\tif removeFromParent {\n\t\tremoveChild(c.Context, c)\n\t}\n}\n\n// WithDeadline returns a copy of the parent context with the deadline adjusted\n// to be no later than d. If the parent's deadline is already earlier than d,\n// WithDeadline(parent, d) is semantically equivalent to parent. The returned\n// context's Done channel is closed when the deadline expires, when the returned\n// cancel function is called, or when the parent context's Done channel is\n// closed, whichever happens first.\n//\n// Canceling this context releases resources associated with it, so code should\n// call cancel as soon as the operations running in this Context complete.\nfunc WithDeadline(parent Context, d time.Time) (Context, CancelFunc) {\n\tif parent == nil {\n\t\tpanic(\"cannot create context from nil parent\")\n\t}\n\tif cur, ok := parent.Deadline(); ok && cur.Before(d) {\n\t\t// The current deadline is already sooner than the new one.\n\t\treturn WithCancel(parent)\n\t}\n\tc := &timerCtx{\n\t\tcancelCtx: newCancelCtx(parent),\n\t\tdeadline:  d,\n\t}\n\tpropagateCancel(parent, c)\n\tdur := time.Until(d)\n\tif dur <= 0 {\n\t\tc.cancel(true, DeadlineExceeded) // deadline has already passed\n\t\treturn c, func() { c.cancel(false, Canceled) }\n\t}\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif c.err == nil {\n\t\tc.timer = time.AfterFunc(dur, func() {\n\t\t\tc.cancel(true, DeadlineExceeded)\n\t\t})\n\t}\n\treturn c, func() { c.cancel(true, Canceled) }\n}\n\n// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to\n// implement Done and Err. It implements cancel by stopping its timer then\n// delegating to cancelCtx.cancel.\ntype timerCtx struct {\n\tcancelCtx\n\ttimer *time.Timer // Under cancelCtx.mu.\n\n\tdeadline time.Time\n}\n\nfunc (c *timerCtx) Deadline() (deadline time.Time, ok bool) {\n\treturn c.deadline, true\n}\n\nfunc (c *timerCtx) String() string {\n\treturn contextName(c.cancelCtx.Context) + \".WithDeadline(\" +\n\t\tc.deadline.String() + \" [\" +\n\t\ttime.Until(c.deadline).String() + \"])\"\n}\n\nfunc (c *timerCtx) cancel(removeFromParent bool, err error) {\n\tc.cancelCtx.cancel(false, err)\n\tif removeFromParent {\n\t\t// Remove this timerCtx from its parent cancelCtx's children.\n\t\tremoveChild(c.cancelCtx.Context, c)\n\t}\n\tc.mu.Lock()\n\tif c.timer != nil {\n\t\tc.timer.Stop()\n\t\tc.timer = nil\n\t}\n\tc.mu.Unlock()\n}\n\n// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).\n//\n// Canceling this context releases resources associated with it, so code should\n// call cancel as soon as the operations running in this Context complete:\n//\n// \tfunc slowOperationWithTimeout(ctx context.Context) (Result, error) {\n// \t\tctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)\n// \t\tdefer cancel()  // releases resources if slowOperation completes before timeout elapses\n// \t\treturn slowOperation(ctx)\n// \t}\nfunc WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {\n\treturn WithDeadline(parent, time.Now().Add(timeout))\n}\n\n// WithValue returns a copy of parent in which the value associated with key is\n// val.\n//\n// Use context Values only for request-scoped data that transits processes and\n// APIs, not for passing optional parameters to functions.\n//\n// The provided key must be comparable and should not be of type\n// string or any other built-in type to avoid collisions between\n// packages using context. Users of WithValue should define their own\n// types for keys. To avoid allocating when assigning to an\n// interface{}, context keys often have concrete type\n// struct{}. Alternatively, exported context key variables' static\n// type should be a pointer or interface.\nfunc WithValue(parent Context, key, val interface{}) Context {\n\tif parent == nil {\n\t\tpanic(\"cannot create context from nil parent\")\n\t}\n\tif key == nil {\n\t\tpanic(\"nil key\")\n\t}\n\tif !reflectlite.TypeOf(key).Comparable() {\n\t\tpanic(\"key is not comparable\")\n\t}\n\treturn &valueCtx{parent, key, val}\n}\n\n// A valueCtx carries a key-value pair. It implements Value for that key and\n// delegates all other calls to the embedded Context.\ntype valueCtx struct {\n\tContext\n\tkey, val interface{}\n}\n\n// stringify tries a bit to stringify v, without using fmt, since we don't\n// want context depending on the unicode tables. This is only used by\n// *valueCtx.String().\nfunc stringify(v interface{}) string {\n\tswitch s := v.(type) {\n\tcase stringer:\n\t\treturn s.String()\n\tcase string:\n\t\treturn s\n\t}\n\treturn \"<not Stringer>\"\n}\n\nfunc (c *valueCtx) String() string {\n\treturn contextName(c.Context) + \".WithValue(type \" +\n\t\treflectlite.TypeOf(c.key).String() +\n\t\t\", val \" + stringify(c.val) + \")\"\n}\n\nfunc (c *valueCtx) Value(key interface{}) interface{} {\n\tif c.key == key {\n\t\treturn c.val\n\t}\n\treturn c.Context.Value(key)\n}\n"}}


[Trace - 19:41:45.970 PM] Sending response 'window/workDoneProgress/create - (1)' in 24ms.
Result: 


[Trace - 19:41:45.970 PM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}


[Trace - 19:41:45.971 PM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/projects/google/tools","section":"gopls"}]}


[Trace - 19:41:46.025 PM] Sending response 'workspace/configuration - (2)' in 54ms.
Result: [{"build.experimentalWorkspaceModule":true,"allExperiments":true}]


[Trace - 19:41:46.114 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/06/25 19:41:46 go env for /Users/hakim/projects/google/tools\n(root /Users/hakim/projects/google/tools)\n(go version go version go1.16.4 darwin/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOSUMDB=sum.golang.org\nGOCACHE=/Users/hakim/Library/Caches/go-build\nGOFLAGS=\nGONOPROXY=\nGOPROXY=https://proxy.golang.org,direct\nGO111MODULE=\nGOMOD=/Users/hakim/projects/google/tools/go.mod\nGOPATH=/Users/hakim/go\nGOPRIVATE=\nGOINSECURE=\nGOMODCACHE=/Users/hakim/go/pkg/mod\nGONOSUMDB=\nGOROOT=/usr/local/Cellar/go/1.16.4/libexec\n\n"}


[Info  - 7:41:46 PM] 2021/06/25 19:41:46 go env for /Users/hakim/projects/google/tools
(root /Users/hakim/projects/google/tools)
(go version go version go1.16.4 darwin/amd64)
(valid build configuration = true)
(build flags: [])
GOSUMDB=sum.golang.org
GOCACHE=/Users/hakim/Library/Caches/go-build
GOFLAGS=
GONOPROXY=
GOPROXY=https://proxy.golang.org,direct
GO111MODULE=
GOMOD=/Users/hakim/projects/google/tools/go.mod
GOPATH=/Users/hakim/go
GOPRIVATE=
GOINSECURE=
GOMODCACHE=/Users/hakim/go/pkg/mod
GONOSUMDB=
GOROOT=/usr/local/Cellar/go/1.16.4/libexec


[Trace - 19:41:46.263 PM] Sending request 'textDocument/documentSymbol - (1)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"}}


[Trace - 19:41:46.263 PM] Sending request 'textDocument/codeAction - (2)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"},"range":{"start":{"line":47,"character":0},"end":{"line":47,"character":0}},"context":{"diagnostics":[]}}


[Trace - 19:41:46.490 PM] Sending request 'textDocument/documentLink - (3)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"}}


[Trace - 19:41:46.563 PM] Sending request 'textDocument/foldingRange - (4)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"}}


[Trace - 19:41:46.564 PM] Sending request 'textDocument/codeLens - (5)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"}}


[Trace - 19:41:46.708 PM] Sending notification '$/cancelRequest'.
Params: {"id":5}


[Trace - 19:41:46.966 PM] Sending request 'textDocument/codeLens - (6)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"}}


[Trace - 19:41:47.632 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/06/25 19:41:47 go/packages.Load\n\tsnapshot=0\n\tdirectory=/var/folders/bw/6r6k9d113sv1_vvzk_1kfxbm001py5/T/gopls-workspace-mod682852003\n\tquery=[builtin golang.org/x/tools/... golang.org/x/tools/gopls/...]\n\tpackages=545\n"}


[Info  - 7:41:47 PM] 2021/06/25 19:41:47 go/packages.Load
	snapshot=0
	directory=/var/folders/bw/6r6k9d113sv1_vvzk_1kfxbm001py5/T/gopls-workspace-mod682852003
	query=[builtin golang.org/x/tools/... golang.org/x/tools/gopls/...]
	packages=545

[Trace - 19:41:47.873 PM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"end","message":"Finished loading packages."}}


[Trace - 19:41:47.890 PM] Received request 'client/registerCapability - (3)'.
Params: {"registrations":[{"id":"workspace/didChangeWatchedFiles-0","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"**/*.{go,mod,sum}","kind":7},{"globPattern":"**/*.*tmpl","kind":7},{"globPattern":"{/Users/hakim/projects/google/tools/benchmark,/Users/hakim/projects/google/tools/benchmark/parse,/Users/hakim/projects/google/tools/blog,/Users/hakim/projects/google/tools/blog/atom,/Users/hakim/projects/google/tools/cmd,/Users/hakim/projects/google/tools/cmd/auth,/Users/hakim/projects/google/tools/cmd/auth/authtest,/Users/hakim/projects/google/tools/cmd/auth/cookieauth,/Users/hakim/projects/google/tools/cmd/auth/gitauth,/Users/hakim/projects/google/tools/cmd/auth/netrcauth,/Users/hakim/projects/google/tools/cmd/benchcmp,/Users/hakim/projects/google/tools/cmd/bundle,/Users/hakim/projects/google/tools/cmd/callgraph,/Users/hakim/projects/google/tools/cmd/compilebench,/Users/hakim/projects/google/tools/cmd/cover,/Users/hakim/projects/google/tools/cmd/digraph,/Users/hakim/projects/google/tools/cmd/eg,/Users/hakim/projects/google/tools/cmd/fiximports,/Users/hakim/projects/google/tools/cmd/getgo,/Users/hakim/projects/google/tools/cmd/getgo/server,/Users/hakim/projects/google/tools/cmd/go-contrib-init,/Users/hakim/projects/google/tools/cmd/godex,/Users/hakim/projects/google/tools/cmd/godoc,/Users/hakim/projects/google/tools/cmd/goimports,/Users/hakim/projects/google/tools/cmd/gomvpkg,/Users/hakim/projects/google/tools/cmd/gorename,/Users/hakim/projects/google/tools/cmd/gotype,/Users/hakim/projects/google/tools/cmd/goyacc,/Users/hakim/projects/google/tools/cmd/guru,/Users/hakim/projects/google/tools/cmd/guru/serial,/Users/hakim/projects/google/tools/cmd/html2article,/Users/hakim/projects/google/tools/cmd/present,/Users/hakim/projects/google/tools/cmd/present/templates,/Users/hakim/projects/google/tools/cmd/present2md,/Users/hakim/projects/google/tools/cmd/splitdwarf,/Users/hakim/projects/google/tools/cmd/splitdwarf/internal,/Users/hakim/projects/google/tools/cmd/splitdwarf/internal/macho,/Users/hakim/projects/google/tools/cmd/ssadump,/Users/hakim/projects/google/tools/cmd/stress,/Users/hakim/projects/google/tools/cmd/stringer,/Users/hakim/projects/google/tools/cmd/toolstash,/Users/hakim/projects/google/tools/container,/Users/hakim/projects/google/tools/container/intsets,/Users/hakim/projects/google/tools/copyright,/Users/hakim/projects/google/tools/cover,/Users/hakim/projects/google/tools/go,/Users/hakim/projects/google/tools/go/analysis,/Users/hakim/projects/google/tools/go/analysis/analysistest,/Users/hakim/projects/google/tools/go/analysis/internal,/Users/hakim/projects/google/tools/go/analysis/internal/analysisflags,/Users/hakim/projects/google/tools/go/analysis/internal/checker,/Users/hakim/projects/google/tools/go/analysis/internal/facts,/Users/hakim/projects/google/tools/go/analysis/multichecker,/Users/hakim/projects/google/tools/go/analysis/passes,/Users/hakim/projects/google/tools/go/analysis/passes/asmdecl,/Users/hakim/projects/google/tools/go/analysis/passes/assign,/Users/hakim/projects/google/tools/go/analysis/passes/atomic,/Users/hakim/projects/google/tools/go/analysis/passes/atomicalign,/Users/hakim/projects/google/tools/go/analysis/passes/bools,/Users/hakim/projects/google/tools/go/analysis/passes/buildssa,/Users/hakim/projects/google/tools/go/analysis/passes/buildtag,/Users/hakim/projects/google/tools/go/analysis/passes/cgocall,/Users/hakim/projects/google/tools/go/analysis/passes/composite,/Users/hakim/projects/google/tools/go/analysis/passes/copylock,/Users/hakim/projects/google/tools/go/analysis/passes/ctrlflow,/Users/hakim/projects/google/tools/go/analysis/passes/deepequalerrors,/Users/hakim/projects/google/tools/go/analysis/passes/errorsas,/Users/hakim/projects/google/tools/go/analysis/passes/fieldalignment,/Users/hakim/projects/google/tools/go/analysis/passes/fieldalignment/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment,/Users/hakim/projects/google/tools/go/analysis/passes/findcall,/Users/hakim/projects/google/tools/go/analysis/passes/findcall/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/findcall/cmd/findcall,/Users/hakim/projects/google/tools/go/analysis/passes/framepointer,/Users/hakim/projects/google/tools/go/analysis/passes/httpresponse,/Users/hakim/projects/google/tools/go/analysis/passes/ifaceassert,/Users/hakim/projects/google/tools/go/analysis/passes/ifaceassert/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/ifaceassert/cmd/ifaceassert,/Users/hakim/projects/google/tools/go/analysis/passes/inspect,/Users/hakim/projects/google/tools/go/analysis/passes/internal,/Users/hakim/projects/google/tools/go/analysis/passes/internal/analysisutil,/Users/hakim/projects/google/tools/go/analysis/passes/loopclosure,/Users/hakim/projects/google/tools/go/analysis/passes/lostcancel,/Users/hakim/projects/google/tools/go/analysis/passes/lostcancel/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/lostcancel/cmd/lostcancel,/Users/hakim/projects/google/tools/go/analysis/passes/nilfunc,/Users/hakim/projects/google/tools/go/analysis/passes/nilness,/Users/hakim/projects/google/tools/go/analysis/passes/nilness/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/nilness/cmd/nilness,/Users/hakim/projects/google/tools/go/analysis/passes/pkgfact,/Users/hakim/projects/google/tools/go/analysis/passes/printf,/Users/hakim/projects/google/tools/go/analysis/passes/reflectvaluecompare,/Users/hakim/projects/google/tools/go/analysis/passes/shadow,/Users/hakim/projects/google/tools/go/analysis/passes/shadow/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/shadow/cmd/shadow,/Users/hakim/projects/google/tools/go/analysis/passes/shift,/Users/hakim/projects/google/tools/go/analysis/passes/sigchanyzer,/Users/hakim/projects/google/tools/go/analysis/passes/sortslice,/Users/hakim/projects/google/tools/go/analysis/passes/stdmethods,/Users/hakim/projects/google/tools/go/analysis/passes/stringintconv,/Users/hakim/projects/google/tools/go/analysis/passes/stringintconv/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/stringintconv/cmd/stringintconv,/Users/hakim/projects/google/tools/go/analysis/passes/structtag,/Users/hakim/projects/google/tools/go/analysis/passes/testinggoroutine,/Users/hakim/projects/google/tools/go/analysis/passes/tests,/Users/hakim/projects/google/tools/go/analysis/passes/unmarshal,/Users/hakim/projects/google/tools/go/analysis/passes/unmarshal/cmd,/Users/hakim/projects/google/tools/go/analysis/passes/unmarshal/cmd/unmarshal,/Users/hakim/projects/google/tools/go/analysis/passes/unreachable,/Users/hakim/projects/google/tools/go/analysis/passes/unsafeptr,/Users/hakim/projects/google/tools/go/analysis/passes/unusedresult,/Users/hakim/projects/google/tools/go/analysis/passes/unusedwrite,/Users/hakim/projects/google/tools/go/analysis/singlechecker,/Users/hakim/projects/google/tools/go/analysis/unitchecker,/Users/hakim/projects/google/tools/go/ast,/Users/hakim/projects/google/tools/go/ast/astutil,/Users/hakim/projects/google/tools/go/ast/inspector,/Users/hakim/projects/google/tools/go/buildutil,/Users/hakim/projects/google/tools/go/callgraph,/Users/hakim/projects/google/tools/go/callgraph/cha,/Users/hakim/projects/google/tools/go/callgraph/rta,/Users/hakim/projects/google/tools/go/callgraph/static,/Users/hakim/projects/google/tools/go/callgraph/vta,/Users/hakim/projects/google/tools/go/cfg,/Users/hakim/projects/google/tools/go/expect,/Users/hakim/projects/google/tools/go/gccgoexportdata,/Users/hakim/projects/google/tools/go/gcexportdata,/Users/hakim/projects/google/tools/go/internal,/Users/hakim/projects/google/tools/go/internal/cgo,/Users/hakim/projects/google/tools/go/internal/gccgoimporter,/Users/hakim/projects/google/tools/go/internal/gcimporter,/Users/hakim/projects/google/tools/go/internal/packagesdriver,/Users/hakim/projects/google/tools/go/loader,/Users/hakim/projects/google/tools/go/packages,/Users/hakim/projects/google/tools/go/packages/gopackages,/Users/hakim/projects/google/tools/go/packages/packagestest,/Users/hakim/projects/google/tools/go/pointer,/Users/hakim/projects/google/tools/go/ssa,/Users/hakim/projects/google/tools/go/ssa/interp,/Users/hakim/projects/google/tools/go/ssa/ssautil,/Users/hakim/projects/google/tools/go/types,/Users/hakim/projects/google/tools/go/types/objectpath,/Users/hakim/projects/google/tools/go/types/typeutil,/Users/hakim/projects/google/tools/go/vcs,/Users/hakim/projects/google/tools/godoc,/Users/hakim/projects/google/tools/godoc/analysis,/Users/hakim/projects/google/tools/godoc/redirect,/Users/hakim/projects/google/tools/godoc/static,/Users/hakim/projects/google/tools/godoc/util,/Users/hakim/projects/google/tools/godoc/vfs,/Users/hakim/projects/google/tools/godoc/vfs/gatefs,/Users/hakim/projects/google/tools/godoc/vfs/httpfs,/Users/hakim/projects/google/tools/godoc/vfs/mapfs,/Users/hakim/projects/google/tools/godoc/vfs/zipfs,/Users/hakim/projects/google/tools/gopls,/Users/hakim/projects/google/tools/gopls/doc,/Users/hakim/projects/google/tools/gopls/integration,/Users/hakim/projects/google/tools/gopls/integration/govim,/Users/hakim/projects/google/tools/gopls/internal,/Users/hakim/projects/google/tools/gopls/internal/hooks,/Users/hakim/projects/google/tools/gopls/internal/regtest,/Users/hakim/projects/google/tools/gopls/internal/regtest/bench,/Users/hakim/projects/google/tools/gopls/internal/regtest/codelens,/Users/hakim/projects/google/tools/gopls/internal/regtest/completion,/Users/hakim/projects/google/tools/gopls/internal/regtest/diagnostics,/Users/hakim/projects/google/tools/gopls/internal/regtest/misc,/Users/hakim/projects/google/tools/gopls/internal/regtest/modfile,/Users/hakim/projects/google/tools/gopls/internal/regtest/watch,/Users/hakim/projects/google/tools/gopls/internal/regtest/workspace,/Users/hakim/projects/google/tools/gopls/release,/Users/hakim/projects/google/tools/gopls/test,/Users/hakim/projects/google/tools/gopls/test/debug,/Users/hakim/projects/google/tools/imports,/Users/hakim/projects/google/tools/internal,/Users/hakim/projects/google/tools/internal/analysisinternal,/Users/hakim/projects/google/tools/internal/apidiff,/Users/hakim/projects/google/tools/internal/event,/Users/hakim/projects/google/tools/internal/event/core,/Users/hakim/projects/google/tools/internal/event/export,/Users/hakim/projects/google/tools/internal/event/export/eventtest,/Users/hakim/projects/google/tools/internal/event/export/metric,/Users/hakim/projects/google/tools/internal/event/export/ocagent,/Users/hakim/projects/google/tools/internal/event/export/ocagent/wire,/Users/hakim/projects/google/tools/internal/event/export/prometheus,/Users/hakim/projects/google/tools/internal/event/keys,/Users/hakim/projects/google/tools/internal/event/label,/Users/hakim/projects/google/tools/internal/fakenet,/Users/hakim/projects/google/tools/internal/fastwalk,/Users/hakim/projects/google/tools/internal/gocommand,/Users/hakim/projects/google/tools/internal/gopathwalk,/Users/hakim/projects/google/tools/internal/imports,/Users/hakim/projects/google/tools/internal/jsonrpc2,/Users/hakim/projects/google/tools/internal/jsonrpc2/servertest,/Users/hakim/projects/google/tools/internal/jsonrpc2_v2,/Users/hakim/projects/google/tools/internal/lsp,/Users/hakim/projects/google/tools/internal/lsp/analysis,/Users/hakim/projects/google/tools/internal/lsp/analysis/fillreturns,/Users/hakim/projects/google/tools/internal/lsp/analysis/fillstruct,/Users/hakim/projects/google/tools/internal/lsp/analysis/nonewvars,/Users/hakim/projects/google/tools/internal/lsp/analysis/noresultvalues,/Users/hakim/projects/google/tools/internal/lsp/analysis/simplifycompositelit,/Users/hakim/projects/google/tools/internal/lsp/analysis/simplifyrange,/Users/hakim/projects/google/tools/internal/lsp/analysis/simplifyslice,/Users/hakim/projects/google/tools/internal/lsp/analysis/undeclaredname,/Users/hakim/projects/google/tools/internal/lsp/analysis/unusedparams,/Users/hakim/projects/google/tools/internal/lsp/browser,/Users/hakim/projects/google/tools/internal/lsp/cache,/Users/hakim/projects/google/tools/internal/lsp/cmd,/Users/hakim/projects/google/tools/internal/lsp/cmd/test,/Users/hakim/projects/google/tools/internal/lsp/command,/Users/hakim/projects/google/tools/internal/lsp/command/commandmeta,/Users/hakim/projects/google/tools/internal/lsp/command/gen,/Users/hakim/projects/google/tools/internal/lsp/debug,/Users/hakim/projects/google/tools/internal/lsp/debug/log,/Users/hakim/projects/google/tools/internal/lsp/debug/tag,/Users/hakim/projects/google/tools/internal/lsp/diff,/Users/hakim/projects/google/tools/internal/lsp/diff/difftest,/Users/hakim/projects/google/tools/internal/lsp/diff/myers,/Users/hakim/projects/google/tools/internal/lsp/fake,/Users/hakim/projects/google/tools/internal/lsp/fuzzy,/Users/hakim/projects/google/tools/internal/lsp/helper,/Users/hakim/projects/google/tools/internal/lsp/lsprpc,/Users/hakim/projects/google/tools/internal/lsp/mod,/Users/hakim/projects/google/tools/internal/lsp/protocol,/Users/hakim/projects/google/tools/internal/lsp/regtest,/Users/hakim/projects/google/tools/internal/lsp/snippet,/Users/hakim/projects/google/tools/internal/lsp/source,/Users/hakim/projects/google/tools/internal/lsp/source/completion,/Users/hakim/projects/google/tools/internal/lsp/template,/Users/hakim/projects/google/tools/internal/lsp/tests,/Users/hakim/projects/google/tools/internal/memoize,/Users/hakim/projects/google/tools/internal/packagesinternal,/Users/hakim/projects/google/tools/internal/proxydir,/Users/hakim/projects/google/tools/internal/span,/Users/hakim/projects/google/tools/internal/stack,/Users/hakim/projects/google/tools/internal/stack/gostacks,/Users/hakim/projects/google/tools/internal/stack/stacktest,/Users/hakim/projects/google/tools/internal/testenv,/Users/hakim/projects/google/tools/internal/tool,/Users/hakim/projects/google/tools/internal/typeparams,/Users/hakim/projects/google/tools/internal/typesinternal,/Users/hakim/projects/google/tools/internal/xcontext,/Users/hakim/projects/google/tools/playground,/Users/hakim/projects/google/tools/playground/socket,/Users/hakim/projects/google/tools/present,/Users/hakim/projects/google/tools/refactor,/Users/hakim/projects/google/tools/refactor/eg,/Users/hakim/projects/google/tools/refactor/importgraph,/Users/hakim/projects/google/tools/refactor/rename,/Users/hakim/projects/google/tools/refactor/satisfy,/Users/hakim/projects/google/tools/txtar}","kind":7}]}}]}


[Trace - 19:41:47.949 PM] Sending response 'client/registerCapability - (3)' in 59ms.
Result: 


[Trace - 19:41:47.951 PM] Received request 'client/registerCapability - (4)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"},{"id":"workspace/didChangeWorkspaceFolders","method":"workspace/didChangeWorkspaceFolders"},{"id":"textDocument/semanticTokens","method":"textDocument/semanticTokens","registerOptions":{"legend":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"]},"range":true,"full":true}}]}


[Trace - 19:41:47.960 PM] Sending response 'client/registerCapability - (4)' in 8ms.
Result: 


[Trace - 19:41:48.037 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2021/06/25 19:41:48 discovered missing identifiers: map[memRecordCycle:true pageBits:true]\n\tpackage=\"runtime\"\n"}


[Info  - 7:41:48 PM] 2021/06/25 19:41:48 discovered missing identifiers: map[memRecordCycle:true pageBits:true]
	package="runtime"

[Trace - 19:41:48.062 PM] Sending request 'textDocument/semanticTokens/range - (7)'.
Params: {"textDocument":{"uri":"file:///usr/local/Cellar/go/1.16.4/libexec/src/context/context.go"},"range":{"start":{"line":0,"character":0},"end":{"line":39,"character":78}}}


[Trace - 19:41:48.102 PM] Received response 'textDocument/documentSymbol - (1)' in 1839ms.
Result: [{"name":"Context","detail":"interface{...}","kind":11,"range":{"start":{"line":61,"character":5},"end":{"line":153,"character":1}},"selectionRange":{"start":{"line":61,"character":5},"end":{"line":61,"character":12}},"children":[{"name":"Deadline","kind":6,"range":{"start":{"line":65,"character":1},"end":{"line":65,"character":41}},"selectionRange":{"start":{"line":65,"character":1},"end":{"line":65,"character":9}}},{"name":"Done","kind":6,"range":{"start":{"line":98,"character":1},"end":{"line":98,"character":23}},"selectionRange":{"start":{"line":98,"character":1},"end":{"line":98,"character":5}}},{"name":"Err","kind":6,"range":{"start":{"line":105,"character":1},"end":{"line":105,"character":12}},"selectionRange":{"start":{"line":105,"character":1},"end":{"line":105,"character":4}}},{"name":"Value","kind":6,"range":{"start":{"line":152,"character":1},"end":{"line":152,"character":35}},"selectionRange":{"start":{"line":152,"character":1},"end":{"line":152,"character":6}}}]},{"name":"Canceled","detail":"error","kind":13,"range":{"start":{"line":156,"character":0},"end":{"line":156,"character":45}},"selectionRange":{"start":{"line":156,"character":4},"end":{"line":156,"character":12}}},{"name":"DeadlineExceeded","detail":"error","kind":13,"range":{"start":{"line":160,"character":0},"end":{"line":160,"character":52}},"selectionRange":{"start":{"line":160,"character":4},"end":{"line":160,"character":20}}},{"name":"deadlineExceededError","detail":"struct{...}","kind":23,"range":{"start":{"line":162,"character":5},"end":{"line":162,"character":35}},"selectionRange":{"start":{"line":162,"character":5},"end":{"line":162,"character":26}}},{"name":"(deadlineExceededError).Error","detail":"()","kind":6,"range":{"start":{"line":164,"character":0},"end":{"line":164,"character":43}},"selectionRange":{"start":{"line":164,"character":29},"end":{"line":164,"character":34}}},{"name":"(deadlineExceededError).Timeout","detail":"()","kind":6,"range":{"start":{"line":165,"character":0},"end":{"line":165,"character":43}},"selectionRange":{"start":{"line":165,"character":29},"end":{"line":165,"character":36}}},{"name":"(deadlineExceededError).Temporary","detail":"()","kind":6,"range":{"start":{"line":166,"character":0},"end":{"line":166,"character":45}},"selectionRange":{"start":{"line":166,"character":29},"end":{"line":166,"character":38}}},{"name":"Background","detail":"()","kind":12,"range":{"start":{"line":207,"character":0},"end":{"line":207,"character":25}},"selectionRange":{"start":{"line":207,"character":5},"end":{"line":207,"character":15}}},{"name":"TODO","detail":"()","kind":12,"range":{"start":{"line":215,"character":0},"end":{"line":215,"character":19}},"selectionRange":{"start":{"line":215,"character":5},"end":{"line":215,"character":9}}},{"name":"CancelFunc","detail":"func()","kind":12,"range":{"start":{"line":223,"character":5},"end":{"line":223,"character":22}},"selectionRange":{"start":{"line":223,"character":5},"end":{"line":223,"character":15}}},{"name":"WithCancel","detail":"(parent Context)","kind":12,"range":{"start":{"line":231,"character":0},"end":{"line":231,"character":64}},"selectionRange":{"start":{"line":231,"character":5},"end":{"line":231,"character":15}}},{"name":"cancelCtx","detail":"struct{...}","kind":23,"range":{"start":{"line":343,"character":5},"end":{"line":350,"character":1}},"selectionRange":{"start":{"line":343,"character":5},"end":{"line":343,"character":14}},"children":[{"name":"Context","detail":"interface{...}","kind":8,"range":{"start":{"line":344,"character":1},"end":{"line":344,"character":8}},"selectionRange":{"start":{"line":344,"character":1},"end":{"line":344,"character":8}}}]},{"name":"(*cancelCtx).Value","detail":"(key interface{})","kind":6,"range":{"start":{"line":352,"character":0},"end":{"line":352,"character":54}},"selectionRange":{"start":{"line":352,"character":20},"end":{"line":352,"character":25}}},{"name":"(*cancelCtx).Done","detail":"()","kind":6,"range":{"start":{"line":359,"character":0},"end":{"line":359,"character":42}},"selectionRange":{"start":{"line":359,"character":20},"end":{"line":359,"character":24}}},{"name":"(*cancelCtx).Err","detail":"()","kind":6,"range":{"start":{"line":369,"character":0},"end":{"line":369,"character":31}},"selectionRange":{"start":{"line":369,"character":20},"end":{"line":369,"character":23}}},{"name":"(*cancelCtx).String","detail":"()","kind":6,"range":{"start":{"line":387,"character":0},"end":{"line":387,"character":35}},"selectionRange":{"start":{"line":387,"character":20},"end":{"line":387,"character":26}}},{"name":"WithDeadline","detail":"(parent Context, d time.Time)","kind":12,"range":{"start":{"line":429,"character":0},"end":{"line":429,"character":68}},"selectionRange":{"start":{"line":429,"character":5},"end":{"line":429,"character":17}}},{"name":"WithTimeout","detail":"(parent Context, timeout time.Duration)","kind":12,"range":{"start":{"line":501,"character":0},"end":{"line":501,"character":77}},"selectionRange":{"start":{"line":501,"character":5},"end":{"line":501,"character":16}}},{"name":"WithValue","detail":"(parent Context, key interface{}, val interface{})","kind":12,"range":{"start":{"line":518,"character":0},"end":{"line":518,"character":60}},"selectionRange":{"start":{"line":518,"character":5},"end":{"line":518,"character":14}}}]

</details>

@stamblerre
Copy link
Contributor

Thanks for confirming, @hyangah! I'll transfer to the gopls issue tracker.

@stamblerre stamblerre transferred this issue from golang/vscode-go Jun 28, 2021
@findleyr
Copy link
Contributor

Presumably this is due to AST trimming. I'll take a look.

@stamblerre stamblerre added this to the gopls/unplanned milestone Jun 28, 2021
@stamblerre stamblerre changed the title Code outline not work well for golang x/tools/gopls: incorrect document outline for structs Jun 28, 2021
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. Documentation labels Jun 28, 2021
@adonovan adonovan added the Refactoring Issues related to refactoring tools label Apr 24, 2023
@findleyr
Copy link
Contributor

We eliminated AST trimming with v0.12.0, so this was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

6 participants