Skip to content

Commit 19d7aba

Browse files
committed
[gopls-release-branch.0.7] all: merge master into gopls-release-branch.0.7
4fe0d6c internal/lsp: skip signature help within a string literal 0c506a2 internal/lsp/source: evaluate bin/hex literal on hover 46d1522 internal/lsp: add extract to method code action c740bfd internal/lsp: handle incorrect import with CRLF line endings 251092d internal/lsp/source: compute imports text edits from scratch 412ee17 all: add SliceToArrayPointer instruction 7f68387 internal/lsp/source: workspace symbol improvements for selectors 7aa8294 internal/lsp: handle panic in fix AST 6e9046b gopls/doc: fix imports function for Neovim LSP 0cf4e27 internal/lsp/semantic: improve semantic token processing 5061c41 internal/lsp: signal diagnostic completion if modification failed ef97713 gopls/doc: add vetted examples for Sublime Text 8e85a28 internal/lsp: adopt bcmills' suggestion for an improved debouncer API ae0deb7 internal/lsp: fix variable reuse bug in code actions d36a54b internal/lsp: improve package search in a couple places 3844600 gopls/internal/regtest: add a flag to profile didChange handling de44776 gopls/doc: Neovim v0.5 is now stable ccff732 internal/lsp/source: fix comment update during rename for short variable declarations a7dfe3d internal/lsp: attempt to make TestDebouncer more robust 980829d internal/lsp/lsprpc: add an AutoDialer abstraction cb1acef Revert "internal/lsp/semantic.go: repress useless messages and tighten logic" 5b540d3 internal/lsp/semantic.go: repress useless messages and tighten logic e33c0f2 go/packages: skip tests that link binaries in short mode 8e32e9f internal/lsp/regtest: fix a panic TestResolveImportCycle 2583041 go/packages: fix data race in TestCgoNoSyntax 6994825 go/ssa: incorrect document in type Builtin struct e688b94 go/packages: parallelize most tests 64bd808 internal/lsp/cache: don't report a context error if load succeeded cae92d5 go/packages: skip GOPATH tests in short mode 2f04284 internal/lsp/regtest: allow for unsent diagnostics in TestResolveImportCycle 41a65bd internal/lsp: avoid flake in TestDebouncer 1c9019e internal/lsp/cache: fix raciness of updating the view workspace febfa9d internal/lsp/source: move diagnosticsDelay out of experimental 71eae3a internal/lsp/cache: be consistent about using snapshot.FileSet 251f283 internal/lsp: add a setting to batch didChangeWatchedFile notifications c979f92 internal/lsp/cache: invalidate packages in setMetadata 55cd480 gopls/doc: Document how gopls generates semantic tokens. 77c1b7a internal/lsp/cmd: print flags when running gopls help 640c1de go/ssa: support unsafe.Add and unsafe.Slice fd00574 internal/lsp/protocol: upgrade generated lsp code to beginning of July 7edcfe5 internal/lsp/lsprpc: add a goenv middleware e3040f2 internal/lsp/lsprpc: add a CommandInterceptor middleware ea37029 internal/lsp/lsprpc: use middleware for the V2 handshaking 20dafe5 go/ssa: allow conversion from slice to array pointer f0847e0 go/callgraph: change reflect.Call to reflect.Value.Call in comment 72e4d1b go/internal/cgo: handle symlinks with $PWD, not -srcdir 100b229 internal/lsp/cache: treat load timeouts as critical errors 12f8456 internal/testenv: actually Exit if small machine for netbsd-arm*-bsiegert 00129ff internal/lsp/lsprpc: update binder tests to handle forwarding fe2294a internal/jsonrpc2_v2: initialize async before binding 636017e internal/lsp/cache: fix missing pkg error on Windows 48cad5e tools/gopls: small fixes to contributing.md da404b5 internal/lsp: start parsing go.work file like gopls.mod file 4833ac5 internal/mod: add workfile parser bfc1674 internal/lsp/cache: fix loading of std and cmd d824a74 gopls/doc: include instructions for compiling generic code 6d3e439 gopls/doc: add instructions for working with generic code 4c651fc internal/lsp/source: add inferred types to generic function hover d25f906 internal/lsp: do not block on channel when there is an error 463a76b internal/lsp: only reload invalid metadata when necessary 116feae internal/lsp: move the progress tracker to the session 3f7c326 gopls/internal/regtest: skip the flaky TestResolveImportCycle b12e617 internal/lsp/cache: don't delete metadata until it's reloaded 4b484fb internal/lsp: exclude the module cache from the workspace 9a55cb1 internal/lsp/command: minor clean-up of StartDebugging description 490eac8 internal/lsp/command: add missing doc and support for result parameters 9aa007e internal/lsp/cache: invalidate broken packages when imports are deleted f6327c5 vta: adds the VTA call graph construction 13cf844 go/ast/astutil: fix panic when rewriting multi-argument type instances 937957b vta: adds VTA graph propagation functionality e0b9cf7 lsp/completion: support completing to Elem() types 16e5f55 lsp/completion: search deeper for candidate type mods b579874 lsp/completion: reorganize how we track candidate type mods 890984b internal/lsp: change generated variable names to be more verbose 9f230b5 internal/lsp: fix extract bug choosing available identifiers 4e58f8f internal/lsp: handle out of range panic in template parsing 716319f vta: finalizes VTA graph construction by adding support for function calls 234f954 vta: extends VTA graph construction to handle collections 126df1d cmd/getgo: determine current version via /dl/?mode=json API b9b845e internal/lsp: fix folding range for block comments 1225b6f internal/lsp: memoize allKnownSubdirs instead of recomputing 7295a4e lsp/completion: don't offer untyped conversions bf13205 vta: adds VTA graph construction for basic program statements 8f2cf6c gopls/internal/regtest: clean up TestFillReturnsPanic 4abb1e2 internal/lsp: handle empty buffers in template parsing 7ac129f internal/lsp: don't diagnose/analyze intermediate test variants 1c2154a internal/lsp: address some staticcheck warning Change-Id: Ie2238b8bad61a238b46d1e5ae34e0c5fd13950be
2 parents 64d95d5 + 4fe0d6c commit 19d7aba

File tree

222 files changed

+9655
-1820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+9655
-1820
lines changed

cmd/getgo/download.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"archive/zip"
1313
"compress/gzip"
1414
"crypto/sha256"
15+
"encoding/json"
1516
"fmt"
1617
"io"
1718
"io/ioutil"
@@ -22,7 +23,6 @@ import (
2223
)
2324

2425
const (
25-
currentVersionURL = "https://golang.org/VERSION?m=text"
2626
downloadURLPrefix = "https://dl.google.com/go"
2727
)
2828

@@ -168,18 +168,24 @@ func unpackZip(src, dest string) error {
168168
}
169169

170170
func getLatestGoVersion() (string, error) {
171-
resp, err := http.Get(currentVersionURL)
171+
resp, err := http.Get("https://golang.org/dl/?mode=json")
172172
if err != nil {
173173
return "", fmt.Errorf("Getting current Go version failed: %v", err)
174174
}
175175
defer resp.Body.Close()
176-
if resp.StatusCode > 299 {
176+
if resp.StatusCode != http.StatusOK {
177177
b, _ := ioutil.ReadAll(io.LimitReader(resp.Body, 1024))
178-
return "", fmt.Errorf("Could not get current Go version: HTTP %d: %q", resp.StatusCode, b)
178+
return "", fmt.Errorf("Could not get current Go release: HTTP %d: %q", resp.StatusCode, b)
179+
}
180+
var releases []struct {
181+
Version string
179182
}
180-
version, err := ioutil.ReadAll(resp.Body)
183+
err = json.NewDecoder(resp.Body).Decode(&releases)
181184
if err != nil {
182185
return "", err
183186
}
184-
return strings.TrimSpace(string(version)), nil
187+
if len(releases) < 1 {
188+
return "", fmt.Errorf("Could not get at least one Go release")
189+
}
190+
return releases[0].Version, nil
185191
}

go/ast/astutil/rewrite.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"go/ast"
1010
"reflect"
1111
"sort"
12+
13+
"golang.org/x/tools/internal/typeparams"
1214
)
1315

1416
// An ApplyFunc is invoked by Apply for each node n, even if n is nil,
@@ -437,7 +439,11 @@ func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.
437439
}
438440

439441
default:
440-
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
442+
if typeparams.IsListExpr(n) {
443+
a.applyList(n, "ElemList")
444+
} else {
445+
panic(fmt.Sprintf("Apply: unexpected node type %T", n))
446+
}
441447
}
442448

443449
if a.post != nil && !a.post(&a.cursor) {

go/ast/astutil/rewrite_test.go

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ import (
1313
"testing"
1414

1515
"golang.org/x/tools/go/ast/astutil"
16+
"golang.org/x/tools/internal/typeparams"
1617
)
1718

18-
var rewriteTests = [...]struct {
19+
type rewriteTest struct {
1920
name string
2021
orig, want string
2122
pre, post astutil.ApplyFunc
22-
}{
23+
}
24+
25+
var rewriteTests = []rewriteTest{
2326
{name: "nop", orig: "package p\n", want: "package p\n"},
2427

2528
{name: "replace",
@@ -190,6 +193,34 @@ var z int
190193
},
191194
}
192195

196+
func init() {
197+
if typeparams.Enabled {
198+
rewriteTests = append(rewriteTests, rewriteTest{
199+
name: "replace",
200+
orig: `package p
201+
202+
type T[P1, P2 any] int
203+
204+
type R T[int, string]
205+
`,
206+
want: `package p
207+
208+
type T[P1, P2 any] int32
209+
210+
type R T[int32, string]
211+
`,
212+
post: func(c *astutil.Cursor) bool {
213+
if ident, ok := c.Node().(*ast.Ident); ok {
214+
if ident.Name == "int" {
215+
c.Replace(ast.NewIdent("int32"))
216+
}
217+
}
218+
return true
219+
},
220+
})
221+
}
222+
}
223+
193224
func valspec(name, typ string) *ast.ValueSpec {
194225
return &ast.ValueSpec{Names: []*ast.Ident{ast.NewIdent(name)},
195226
Type: ast.NewIdent(typ),

go/callgraph/callgraph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (n *Node) String() string {
8989
// A Edge represents an edge in the call graph.
9090
//
9191
// Site is nil for edges originating in synthetic or intrinsic
92-
// functions, e.g. reflect.Call or the root of the call graph.
92+
// functions, e.g. reflect.Value.Call or the root of the call graph.
9393
type Edge struct {
9494
Caller *Node
9595
Site ssa.CallInstruction

0 commit comments

Comments
 (0)