Skip to content

Commit 67ebb41

Browse files
committed
all: merge master (9b156ee) into gopls-release-branch.0.8
For golang/go#51074 Merge List: + 2022-02-08 9b156ee internal/lsp/source: provide full documentation of builtin types + 2022-02-08 caecc2b internal/typeparams: add a generic form of types.AssignableTo + 2022-02-07 164402d internal/lsp/cache: set types.Config.GoVersion + 2022-02-07 6aaba77 internal/lsp/debug: add go version to gopls version output + 2022-02-04 414ec9c internal/lsp: add ListImports + 2022-02-04 d55d892 gopls/doc: how to request a particular gopls w/ sublime text + 2022-02-04 cf66aec gopls: update coc.nvim documentation for using go.work + 2022-02-04 597b165 internal/lsp/cache: use -workfile on 1.18 + 2022-02-04 8305295 gopls: recognize the go.work file type + 2022-02-04 962260a internal/lsp/source: remove the unused source.DetectLanguage + 2022-02-04 3e30e21 gopls: remove the workspace_metadata command + 2022-02-04 25d2ab2 internal/lsp/cache: fixes for workspace invalidation + 2022-02-04 8d915b1 internal/lsp/cache: simplify workspace construction + 2022-02-04 77f5fa5 internal/lsp/cache: replace old go.work parser with x/mod + 2022-02-03 4da8ceb internal/lsp/source: remove the unused UpdateUserModFile invocation flag + 2022-02-03 727dfdb internal/lsp/source/completion: add conventional acronyms for type names + 2022-02-03 c009ab4 internal/lsp/completion: the inserted text should be what is shown to the user + 2022-02-03 eeb95ae gopls: make 'fastfuzzy' the default fuzzy matcher for workspace symbols + 2022-02-03 ea5e1dc internal/typeparams: add a helper to return the origin method + 2022-02-03 a739c97 internal/lsp/fake: retry ioutil.ReadFile on plan9 if it fails due to exclusive use + 2022-02-03 82366c6 internal/lsp/fake: in WriteFileData, retry writes that fail with ERROR_LOCK_VIOLATION on Windows + 2022-02-02 f6067dc gopls: cleanup the main help pages + 2022-02-02 dfda270 gopls: use the = form in flag parameter printing rather than a space + 2022-02-02 5ad7054 gopls: add long forms for all the 1 rune flags + 2022-02-02 217a9fc gopls: take control of the flag printing + 2022-02-02 afd524f gopls: clean up the help text + 2022-02-02 ec9a7de gopls: write out the raw usage text Change-Id: Ia95ea1601c24eab898b6fdf60938982ad10a7b48
2 parents b9db714 + 9b156ee commit 67ebb41

File tree

108 files changed

+1886
-1761
lines changed

Some content is hidden

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

108 files changed

+1886
-1761
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
require (
66
github.com/yuin/goldmark v1.4.1
7-
golang.org/x/mod v0.5.1
7+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
88
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f
99
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
1010
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
github.com/yuin/goldmark v1.4.1 h1:/vn0k+RBvwlxEmP5E7SZMqNxPhfMVFEJiykr15/0XKM=
22
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
33
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
4-
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
5-
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
6-
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
7-
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
4+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
5+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
6+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
87
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
8+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
99
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
1010
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
1111
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1212
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
1313
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1414
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
15-
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1615
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1716
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
17+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1818
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
1919
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
2020
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
2121
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
2222
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
2323
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
24+
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
2425
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
2526
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
2627
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=

gopls/doc/commands.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,37 @@ Args:
142142
}
143143
```
144144

145+
### **List imports of a file and its package**
146+
Identifier: `gopls.list_imports`
147+
148+
Retrieve a list of imports in the given Go file, and the package it
149+
belongs to.
150+
151+
Args:
152+
153+
```
154+
{
155+
// The file URI.
156+
"URI": string,
157+
}
158+
```
159+
160+
Result:
161+
162+
```
163+
{
164+
// Imports is a list of imports in the requested file.
165+
"Imports": []{
166+
"Path": string,
167+
"Name": string,
168+
},
169+
// PackageImports is a list of all imports in the requested file's package.
170+
"PackageImports": []{
171+
"Path": string,
172+
},
173+
}
174+
```
175+
145176
### **List known packages**
146177
Identifier: `gopls.list_known_packages`
147178

@@ -350,21 +381,4 @@ Args:
350381
}
351382
```
352383

353-
### **Query workspace metadata**
354-
Identifier: `gopls.workspace_metadata`
355-
356-
Query the server for information about active workspaces.
357-
358-
Result:
359-
360-
```
361-
{
362-
// All workspaces for this session.
363-
"Workspaces": []{
364-
"Name": string,
365-
"ModuleDir": string,
366-
},
367-
}
368-
```
369-
370384
<!-- END Commands: DO NOT MANUALLY EDIT THIS SECTION -->

gopls/doc/settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ Must be one of:
398398
* `"FastFuzzy"`
399399
* `"Fuzzy"`
400400

401-
Default: `"Fuzzy"`.
401+
Default: `"FastFuzzy"`.
402402

403403
##### **symbolStyle** *enum*
404404

gopls/doc/subl.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ LSP and gopls settings can also be adjusted on a per-project basis to override g
5656
"settings": {
5757
"LSP": {
5858
"gopls": {
59+
// To use a specific version of gopls with Sublime Text LSP (e.g., to try new features in development)
60+
"command": [
61+
"/path/to/your/go/bin/gopls"
62+
],
5963
"env": {
6064
"PATH": "/path/to/your/go-dev/bin:/path/to/your/go/bin",
6165
"GOPATH": "",

gopls/doc/vim.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Use [coc.nvim], with the following `coc-settings.json` configuration:
9393
"languageserver": {
9494
"golang": {
9595
"command": "gopls",
96-
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
96+
"rootPatterns": ["go.work", "go.mod", ".vim/", ".git/", ".hg/"],
9797
"filetypes": ["go"],
9898
"initializationOptions": {
9999
"usePlaceholders": true
@@ -102,6 +102,13 @@ Use [coc.nvim], with the following `coc-settings.json` configuration:
102102
}
103103
```
104104

105+
If you use `go.work` files, you may want to set the
106+
`workspace.workspaceFolderCheckCwd` option. This will force coc.nvim to search
107+
parent directories for `go.work` files, even if the current open directory has
108+
a `go.mod` file. See the
109+
[coc.nvim documentation](https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders)
110+
for more details.
111+
105112
Other [settings](settings.md) can be added in `initializationOptions` too.
106113

107114
The `editor.action.organizeImport` code action will auto-format code and add missing imports. To run this automatically on save, add the following line to your `init.vim`:

gopls/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/jba/printsrc v0.2.2
88
github.com/jba/templatecheck v0.6.0
99
github.com/sergi/go-diff v1.1.0
10-
golang.org/x/mod v0.5.1
10+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
1111
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9
1212
golang.org/x/tools v0.1.8
1313
honnef.co/go/tools v0.2.2

gopls/go.sum

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,20 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
3838
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
3939
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
4040
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
41-
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
41+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
4242
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
43+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
44+
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
4345
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
46+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
4447
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
4548
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
4649
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
4750
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
4851
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
4952
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5053
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
54+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5155
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5256
golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5357
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=

gopls/internal/regtest/completion/completion_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ func compareCompletionResults(want []string, gotItems []protocol.CompletionItem)
248248
var got []string
249249
for _, item := range gotItems {
250250
got = append(got, item.Label)
251+
if item.Label != item.InsertText && item.TextEdit == nil {
252+
// Label should be the same as InsertText, if InsertText is to be used
253+
return fmt.Sprintf("label not the same as InsertText %#v", item)
254+
}
251255
}
252256

253257
for i, v := range got {

gopls/internal/regtest/diagnostics/diagnostics_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,3 +2138,22 @@ func main() {
21382138
)
21392139
})
21402140
}
2141+
2142+
func TestLangVersion(t *testing.T) {
2143+
testenv.NeedsGo1Point(t, 18) // Requires types.Config.GoVersion, new in 1.18.
2144+
const files = `
2145+
-- go.mod --
2146+
module mod.com
2147+
2148+
go 1.12
2149+
-- main.go --
2150+
package main
2151+
2152+
const C = 0b10
2153+
`
2154+
Run(t, files, func(t *testing.T, env *Env) {
2155+
env.Await(env.DiagnosticAtRegexpWithMessage("main.go", `0b10`, "go1.13 or later"))
2156+
env.WriteWorkspaceFile("go.mod", "module mod.com \n\ngo 1.13\n")
2157+
env.Await(EmptyDiagnostics("main.go"))
2158+
})
2159+
}

0 commit comments

Comments
 (0)