Update golang.org/x dependencies to their latest tagged versions.
Once this CL is submitted, and post-submit testing succeeds on all
first-class ports across all supported Go versions, this repository
will be tagged with its next minor version.
Change-Id: I4837788c74cc58a98186c4517be6231efec17a8c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/466735
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Inspired by http://go.dev/cl/465995, add a blank line between
license and package statement to avoid the license appearing
in the package doc comment.
Change-Id: I867e0729ca1fdc1bcee34964954549e5c92f2b31
Reviewed-on: https://go-review.googlesource.com/c/tools/+/466215
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
This CL addresses code review comments from earlier CLs that were easier
to to in a follow-up.
Change-Id: Ib4bb4cd828377727bdc6dae606fb03d4e06024a6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/466143
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Add additional tests for hover behavior. These tests would have failed
in earlier patchsets of the subsequent CL rewriting hover.
Also, add support for the special "env" file to the marker framework.
Change-Id: Iecbd4994a6c1261f87163d50793fbbc5f26ea1ba
Reviewed-on: https://go-review.googlesource.com/c/tools/+/466135
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Add missing features to the new marker test implementation, implement a
few new markers, and port some tests to demonstrate the new structure.
Additionally, improve UX following some experience working with these
tests.
Specifically:
- Add support for settings.json. This was necessary for standard library
hover, since full documentation was too verbose and varied across Go
versions.
- Ensure that the ordering of ordinary archive files is preserved. I
kept having go.mod sorted below go files, which harms readability.
- Add a helper to provide a nice location summary for test output,
formatting both local and global (=archive-wide) positions.
- Add support for both regexp and string locations conversion.
- Add the loc marker, which is pre-processed to make named locations
available to other markers.
- Add the diag marker, which defines a 1:1 pairing between observed and
expected diagnostics.
- Add the def marker, which runs textDocument/definition.
- Port around half of the godef tests, which include both def and hover
markers. While doing so, try to extract related assertions into
separate tests, to improve organization and documentation and reduce
test size. Remaining tests will have to wait, as this CL was getting
too big.
For golang/go#54845
Change-Id: Id9fe22c00ebd1b3a96eeacc5c0e82fca9c95c680
Reviewed-on: https://go-review.googlesource.com/c/tools/+/465895
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Add a new implementation of the gopls marker tests that shares the same
testing environment as the regression tests. Along the way, revisit the
semantics of the marker framework, to address some problems we've
identified over the years.
Specifically:
- Split tests into self-contained txtar encoded files. Each file
determines an isolated set of markers, and is executed in a separate
session.
- Change the mechanisms for golden content, so that it is joined by
identifiers, and passed to the test method as an argument. This makes
it more apparent where golden content is used, and makes the identity
of golden content stable under manipulations of the source (as opposed
to some arbitrary munging of the note position)
- Allow custom argument conversion that may be convenient for LSP-based
test functions, by avoiding the packagestest framework and instead
building directly on top of the x/tools/go/expect package. As an
initial proof of concept, this allowed using a protocol.Location as a
test method argument.
- Add significant documentation and examples.
- Deprecate the @hover marker in the old marker tests
(gopls/internal/lsp).
I believe that this lays the foundation to address the remaining
concerns enumerated in golang/go#54845, as this new design solves the
isolation problem, the problem of golden file naming, and the lack of
clarity around the definition and construction of test annotations.
For golang/go#54845
Change-Id: I796f35c14370b9651316baa1f86c21c63cec25c7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/465255
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
In the course of debugging something unrelated, I noticed
that loadFromExportData's error result was always discarded.
This change appends it to the set of package errors.
Change-Id: I32a7cbceb7cffd29cedac19eeff8b092663813f0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/466075
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Adds a new MultiConvert instruction. MultiConvert instructions
are a catch all for conversions involving a typeparameter that
would result in multiple different types of conversion
instruction [sequences].
Updates golang/go#56849
Change-Id: I6c2f53ccef1b933406096d6ca2867f1007a13bd3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/457436
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This change resolves two interrelated outstanding bugs in handling Named
types and type declarations in importMap().
1) Named types did not visit their Underlying() types.
2) Whether Named types were fully visited was order dependent.
Previously a Named type was not fully visited (methods visited, etc)
when the type declaration was visited by addObj() before the Named
type was visited by addType().
Fixesgolang/go#49469
Change-Id: Ibf9c6d9afd4958d474149edf2749d994199f14b1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362414
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Add a new helper HoverDocForObject, which finds the relevant object
documentation without needing to type-check. This eliminates the last
use of FindPackageFromPos.
For golang/go#57987
Change-Id: Ic9deec78d68156e9ead3831a8247f8c30259a3c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464455
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
FormatVarType re-formats a variable type using syntax, in order to get
accurate presentation of aliases and ellipses. However, as a result it
required typed syntax trees for the type declaration, which may exist in
a distinct package from the current package.
In the near future we may not have typed syntax trees for these
packages. We could type-check on demand, but (1) that could be costly
and (2) it may break qualification using the go/types qualifier.
Instead, perform this operation using a qualifier based on syntax
and metadata, so that we only need a fully parsed file rather than a
fully type-checked package. The resulting expressions may be inaccurate
due to built-ins, "." imported packages, or missing metadata, but that
seems acceptable for the current use-cases of this function, which are
in completion and signature help.
While doing this, add a FormatNodeWithFile helper that allows formatting
a node from a *token.File, rather than *token.FileSet. This can help us
avoid relying on a global fileset. To facilitate this, move the GetLines
helper from internal/gcimporter into a shared tokeninternal package.
For golang/go#57987
Change-Id: I3b8a5256bc2261be8b5175ee360b9336228928ac
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464301
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
The API of syscall/js package is generated by reusing cmd/api. That has
stopped being a runnable command after an internal refactor in Go 1.20.
Since cmd/api was never really supported or meant to be used outside of
GOROOT, switch to using go/packages and compute the API more directly
ourselves.
Also use the same approach to generate the API of package unsafe (whose
API is also not present in GOROOT/api files at this time) instead of a
fixed list that needs manual maintenance. This adds Add and Slice that
were added to package unsafe in Go 1.17. It also removes ArbitraryType,
since that symbol isn't a part of package unsafe's API but used in its
documentation—it seems like an oversight that it was added in CL 24463.
This CL intentionally leaves out unsafe's SliceData, String, StringData
that were added in Go 1.20, so I can test out the new relui workflow to
send a CL that regenerates this package.
Fixesgolang/go#58245.
For golang/go#38706.
Change-Id: Ibe0d89bf0469691bd16e0d0f501e3762256f2239
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464715
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Enables jump to definition on the second argument in
//go:linkname localname importpath.name
if importpath is a transitive (possibly reverse) dependency
of the package where the directive is located.
Updates golang/go#57312
Change-Id: I59fa5821ffd44449cf49045a88b429f21e22febc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463755
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Type parameter strings have not had subscripts for a long time.
Change-Id: If43c443720335ae98d6b032f23b02639c639af6b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464475
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Now that its scope has been substantially reduced, there's
no need for this type, so this change expands it out to
a triple (or pair in some cases).
The defensive check in NewRange is never needed.
Alsoo, rename RangeToTokenRange to RangePos, following the convention.
Also, fix incorrect uses of the term "wire format".
Change-Id: I5bfc5bf8ce6c9504166cc928cad1df2df000737a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464056
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
Also fix the failing new gopls command integration tests, which observe
a different exit code on plan9.
Change-Id: I5d0c11549deb3d3643f4d7772f0659dfda3600ea
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464297
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Skips inspecting a range of nodes that do not contain any nodes
of a given type. Computes a bitmask of type nodes between push
and pop events. Skips forward to pop if nodes in between cannot
match the type mask.
Benchmarking against previous implementation on "net":
- Preorder filtered by *ast.FuncDecl and *ast.FuncLit
traversal is faster by 11x.
- Preorder filtered by *ast.CallExpr is faster by 10%.
- Unfiltered traveral is 5% slower.
- Constructing events 3% slower.
- Break even for additional computation is 5 *CallExpr
filtered traversals or 1 *Func{Decl,Lit} filtered
traversal.
Change-Id: If4cb566474b84186ff42fb80ed7e1ebb0f692cc2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/458075
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Improves the error message on conflicting overlapping fix suggestions.
Example output:
```
conflicting edits from other and rename on /path/example/foo.go
first edits:
--- base
+++ other
@@ -1,8 +1,8 @@
package other
func Foo() {
- bar := 12
+ bbaz := 12
- _ = bar
+ _ = bbaz
}
// the end
second edits:
--- base
+++ rename
@@ -1,8 +1,8 @@
package other
func Foo() {
- bar := 12
+ baz := 12
- _ = bar
+ _ = baz
}
// the end
```
Rewrite of applyFixes to no longer use trees and to consolidate edits by file uniqueness.
Fixesgolang/go#56535
Change-Id: Ia683888c51a97a357715796b434c2d6ef92c4fef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/457615
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Change-Id: I44a562ec6d71dcf638333a855083f46201ef9a5e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464236
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
There are no changes to main line gopls code.
The type of ParamInitialize.Trace changes from string to a string
type TraceValues. This only affects fake/editor.go
Four messages were changed to go from the server to the client,
necessitating changes to the various test clients.
Some copied comments in tsprotocol.go have changed.
Finally, the parse completeness test found a new field, Deprecated,
in metaModel.json. It duplicates information already in
the Documentation field.
Change-Id: I14bbc63e8b1a1aebb7cd2d55ce282fe42568ecc2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464095
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
If the client prefers markdown, provide markdown.
There is a change to the LSP stubs, with Documentation fields becoming
Or-types (string|MarkupContent). If the client prefers, the returned
Documentation is markdown.
Fixes: golang/go#57300
Change-Id: I57300146333552da3849c1b6bfb97793042faee2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463377
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
For -V=full, use the os.Executable for the program path instead of os.Args[0].
Fixesgolang/go#57716
Change-Id: Ia571f922aef037a16ffc78f8c2c32ae4c70918c1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461496
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Use different diagnostic source names for diagnostics from govulncheck
run ("govulncheck") and diagnostics from gopls's imports analysis
("vulncheck imports").
Fixesgolang/vscode-go#2575
Change-Id: Ic79418146e4793bfc35fbf68d7539c7f0df1a636
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461556
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Nudge developers towards recommended actions by listing them first.
More specifically,
0) Other diagnostics if any (e.g. errors in go.mod)
1) Run govulncheck
2) Upgrade to a specific version
3) Upgrade to latest
4) Reset govulncheck result
Fixesgolang/vscode-go#2576
Change-Id: Ib83f8dab5a1c5bea600fe1ec61701218c7a65ac1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461555
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Start to unwind source.Identifier by unrolling definition, type
definition, and call hierarchy handlers.
Along the way, introduce a couple primitive helper functions, which may
be made obsolete in the future but allowed preserving source.Identifier
behavior:
- referencedObject returns the object referenced by the cursor position,
as defined by source.Identifier.
- mapPosition is a helper to map token.Pos to MappedRange in the narrow
context of a package fileset.
After this change, the only remaining use of source.Identifier is for
Hover, but that is a sizeable refactoring and therefore left to a
subsequent CL.
Updates golang/go#57987
Change-Id: Iba4b0a574e6a6d3d54253f3b4bff8fe6e13a1b15
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463955
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Fix the bug that gopls finds the wrong content when formatting an open
URI whose spelling does not match the spelling on disk (i.e. because of
case insensitivity).
Remove the whole View.filesByBase mechanism: it is problematic as we
can't generally know whether or not we want to associate two different
spellings of the same file: for the purposes of finding packages we may
want to treat Foo.go as foo.go, but we don't want to treat a symlink of
foo.go in another directory the same.
Instead, use robustio.FileID to de-duplicate content in the cache, and
otherwise treat URIs as we receive them. This fixes the formatting
corruption, but means that we don't find packages for the corresponding
file (because go/packages.Load("file=foo.go") fails). A failing test is
added for the latter bug.
Also: use a seenFiles map in the view to satisfy the concern of tracking
relevant files, with a TODO to delete this problematic map.
Along the way, refactor somewhat to separate and normalize the
implementations of source.FileSource.
For golang/go#57081
Change-Id: I02971a1702f057b644fa18a873790e8f0d98a323
Reviewed-on: https://go-review.googlesource.com/c/tools/+/462819
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This change adds a few missing convenience wrappers
in the {PGF,Mapper}.{Pos,Node}MappedRange() cross product.
Change-Id: I0187eae590757e32cd5cb402b3054bcc662e62d3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464096
Auto-Submit: Alan Donovan <adonovan@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
The code was misclassifying K, V in the reciever, as in
func (s *Foo[K, V]) Get(k K) (V, bool)...
Fixes: golang/go#57619
Change-Id: I77eae7929c4b9434c8c25bbc337151dcf90f8452
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463316
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
The version of this file in the main repo uses a "!unix" build
constraint, which had to be ported to a longer list for inclusion in
gopls (which still supports Go versions that predate the "unix" tag).
Solaris is a Unix derivative, and its implementation is provided in
the "fcntl" implementation.
Updates golang/go#57747.
Change-Id: Ibde8ce55dadc03ad3cb797b5320f5b75580f639f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463776
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
This change to PrepareRename eliminates one of the last two
calls to qualifiedObjectsAtProtocolPos. All it needs is
the current file and the object name, so it was overkill.
The last use (from Rename) will be removed in a follow-up;
it is much more involved.
Change-Id: I64a06d95f7d2a88ace0f3c168bad7f0a8c0a7a04
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463896
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
This change moves into rename.go various declarations that,
thanks to recent work, are only used for renaming.
(The moved functions have not changed.)
It also extracts the lengthy "package name" special case
into a separate function, and adds a few comments.
The checkRenaming call has been pulled out of renameObj into
the callers. In one of these, it was not needed.
Change-Id: I4e2d354c098296980b6bcc2fe8ddc2e212e10aa8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463895
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The function used to accept three booleans, the middle of which
was always false. By simplifying under that invariant, the
other two booleans fall away, along with the 'implementations'
query that it used to make.
Small steps...
Change-Id: Ib520661b822afd85d6f0311253779a6202afd33d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463687
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
A helper function for populating LSP requests.
Change-Id: Id9cbca56f8e32321680ba8ee4d7073d097789784
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463683
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
...along with various other Editor methods.
Do we need a more convenient way to say
env.Sandbox.Workdir.URIToPath(loc.URI) ?
Change-Id: I452028db4b99843e07861909ad8cef87cf9fb118
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463655
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Eliminate a couple uses of posToMappedRange, which potentially
type-checks, where it is clearly unnecessary.
Also improve test output for highlight.
Updates golang/go#57987
Updates golang/go#54845
Change-Id: I5580bf6431def0a6ee635e394932934ec7fe1afb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463556
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Following up on CL 461944, eliminate uses of ResolveImportPath.
At two of the three callsites, we avoid type-checking. The one that
remains is in renaming.
For golang/go#57987
Change-Id: Ia974d39f2db72a1fe1373cff5faeb07ecb54effb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463376
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Fix calls to TypeCheck using TypecheckWorkspace where we really want
TypecheckFull. Also, use NarrowestPackage where it suffices.
In approximate order of appearance:
- Code actions, semantic tokens, code lens, and document highlights are
all scoped to a file; the narrowest package for that file should
suffice.
- When completing at a position, we need the full package to find
enclosing context. Furthermore, that file is open, and so will be
fully type-checked by other operations.
- Ditto for suggested fixes, inlay hints, and signature help.
The current behavior leads to incorrect or missing functionality when
outside the workspace. I did not add comprehensive tests demonstrating
this in all cases, but added one for signature help.
For golang/go#57987
Change-Id: I8270d0f0a0787e36bd4103378176d150426d37f2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/463375
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
The cache.pkg type was a mix of metadata-related information and type
checking information, resulting in unnecessary relationships between
type-checking results (which are shared) and loading results (which are
not shared). As a result, the experimentalPackageCacheKey was more or
less a hope that these relationships were valid.
Avoid this relationship altogether by separating the shared
type-checking result from other derived calculations. This makes the
experimentalPackageCacheKey obsolete and lays the groundwork for
type-checking from export data.
Additionally:
- revisit the package cache key to ensure it covers all inputs into
type-checking, and make it more similar to the analysis key
- remove methods from the source.Package API that return source.Package:
we can't have edges between packages if they are going to be
standalone
- remove the experimentalPackageCacheKey setting
- add a test for go list errors
- use the proper types.Sizes when type-checking
- address a comment from an earlier CL in completion_test.go
Fixesgolang/go#57853
Change-Id: I238913c7c8305cb534db77ebec5f062e96ed2503
Reviewed-on: https://go-review.googlesource.com/c/tools/+/461944
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This change removes the last use of the old referencesV1 function.
(Its 'references' helper function still has one remaining use,
from Server.rename.)
The IncomingCalls operation re-parses the files referenced by
the 'references' operation, rather than requesting a type-checked
package.
Also, inline toProtocolIncomingCalls into sole caller.
Change-Id: I33fbb210d42b7ca1a70cfebc4061275a153c3537
Reviewed-on: https://go-review.googlesource.com/c/tools/+/459515
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>