Skip to content

Commit 9c4a092

Browse files
committed
[release] docs/settings.md: update gopls settings
Change-Id: I906b69c0f4d3842bbc9756eac19f9761e0e738a6 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/317889 Trust: Suzy Mueller <[email protected]> Run-TryBot: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> (cherry picked from commit 54986cd) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/317972
1 parent 5f37879 commit 9c4a092

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

docs/settings.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,11 @@ the last filter that applies to a path controls whether it is included.
508508
The path prefix can be empty, so an initial `-` excludes everything.
509509

510510
Examples:
511+
511512
Exclude node_modules: `-node_modules`
513+
512514
Include only project_a: `-` (exclude everything), `+project_a`
515+
513516
Include only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`
514517

515518
### `build.env`
@@ -546,6 +549,22 @@ for multi-module workspaces.
546549

547550

548551
Default: `false`
552+
### `build.memoryMode`
553+
554+
(Experimental) memoryMode controls the tradeoff `gopls` makes between memory usage and
555+
correctness.
556+
557+
Values other than `Normal` are untested and may break in surprising ways.
558+
<br/>
559+
Allowed Options:
560+
561+
* `DegradeClosed`: `"DegradeClosed"`: In DegradeClosed mode, `gopls` will collect less information about
562+
packages without open files. As a result, features like Find
563+
References and Rename will miss results in such packages.
564+
* `Normal`
565+
566+
567+
Default: `"Normal"`
549568
### `formatting.gofumpt`
550569

551570
gofumpt indicates if we should run gofumpt formatting.
@@ -653,7 +672,7 @@ Example Usage:
653672
| `copylocks` | check for locks erroneously passed by value <br/> Inadvertently copying a value containing a lock, such as sync.Mutex or sync.WaitGroup, may cause both copies to malfunction. Generally such values should be referred to through a pointer. <br/> Default: `true` |
654673
| `deepequalerrors` | check for calls of reflect.DeepEqual on error values <br/> The deepequalerrors checker looks for calls of the form: <br/> reflect.DeepEqual(err1, err2) <br/> where err1 and err2 are errors. Using reflect.DeepEqual to compare errors is discouraged. <br/> Default: `true` |
655674
| `errorsas` | report passing non-pointer or non-error values to errors.As <br/> The errorsas analysis reports calls to errors.As where the type of the second argument is not a pointer to a type implementing error. <br/> Default: `true` |
656-
| `fieldalignment` | find structs that would take less memory if their fields were sorted <br/> This analyzer find structs that can be rearranged to take less memory, and provides a suggested edit with the optimal order. <br/> <br/> Default: `false` |
675+
| `fieldalignment` | find structs that would use less memory if their fields were sorted <br/> This analyzer find structs that can be rearranged to use less memory, and provides a suggested edit with the optimal order. <br/> Note that there are two different diagnostics reported. One checks struct size, and the other reports "pointer bytes" used. Pointer bytes is how many bytes of the object that the garbage collector has to potentially scan for pointers, for example: <br/> <pre>struct { uint32; string }</pre><br/> have 16 pointer bytes because the garbage collector has to scan up through the string's inner pointer. <br/> <pre>struct { string; *uint32 }</pre><br/> has 24 pointer bytes because it has to scan further through the *uint32. <br/> <pre>struct { string; uint32 }</pre><br/> has 8 because it can stop immediately after the string pointer. <br/> <br/> Default: `false` |
657676
| `fillreturns` | suggested fixes for "wrong number of return values (want %d, got %d)" <br/> This checker provides suggested fixes for type errors of the type "wrong number of return values (want %d, got %d)". For example: <pre>func m() (int, string, *bool, error) {<br/> return<br/>}</pre>will turn into <pre>func m() (int, string, *bool, error) {<br/> return 0, "", nil, nil<br/>}</pre><br/> This functionality is similar to https://github.com/sqs/goreturns. <br/> <br/> Default: `true` |
658677
| `fillstruct` | note incomplete struct initializations <br/> This analyzer provides diagnostics for any struct literals that do not have any fields initialized. Because the suggested fix for this analysis is expensive to compute, callers should compute it separately, using the SuggestedFix function below. <br/> <br/> Default: `true` |
659678
| `httpresponse` | check for mistakes using HTTP responses <br/> A common mistake when using the net/http package is to defer a function call to close the http.Response Body before checking the error that determines whether the response is valid: <br/> <pre>resp, err := http.Head(url)<br/>defer resp.Body.Close()<br/>if err != nil {<br/> log.Fatal(err)<br/>}<br/>// (defer statement belongs here)</pre><br/> This checker helps uncover latent nil dereference bugs by reporting a diagnostic for such mistakes. <br/> Default: `true` |

package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@
18021802
},
18031803
"build.directoryFilters": {
18041804
"type": "array",
1805-
"markdownDescription": "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nExamples:\nExclude node_modules: `-node_modules`\nInclude only project_a: `-` (exclude everything), `+project_a`\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n",
1805+
"markdownDescription": "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nExamples:\n\nExclude node_modules: `-node_modules`\n\nInclude only project_a: `-` (exclude everything), `+project_a`\n\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n",
18061806
"scope": "resource"
18071807
},
18081808
"build.env": {
@@ -1828,6 +1828,20 @@
18281828
"default": false,
18291829
"scope": "resource"
18301830
},
1831+
"build.memoryMode": {
1832+
"type": "string",
1833+
"markdownDescription": "(Experimental) memoryMode controls the tradeoff `gopls` makes between memory usage and\ncorrectness.\n\nValues other than `Normal` are untested and may break in surprising ways.\n",
1834+
"enum": [
1835+
"DegradeClosed",
1836+
"Normal"
1837+
],
1838+
"markdownEnumDescriptions": [
1839+
"`\"DegradeClosed\"`: In DegradeClosed mode, `gopls` will collect less information about\npackages without open files. As a result, features like Find\nReferences and Rename will miss results in such packages.\n",
1840+
""
1841+
],
1842+
"default": "Normal",
1843+
"scope": "resource"
1844+
},
18311845
"formatting.gofumpt": {
18321846
"type": "boolean",
18331847
"markdownDescription": "gofumpt indicates if we should run gofumpt formatting.\n",
@@ -1978,7 +1992,7 @@
19781992
},
19791993
"fieldalignment": {
19801994
"type": "boolean",
1981-
"markdownDescription": "find structs that would take less memory if their fields were sorted\n\nThis analyzer find structs that can be rearranged to take less memory, and provides\na suggested edit with the optimal order.\n",
1995+
"markdownDescription": "find structs that would use less memory if their fields were sorted\n\nThis analyzer find structs that can be rearranged to use less memory, and provides\na suggested edit with the optimal order.\n\nNote that there are two different diagnostics reported. One checks struct size,\nand the other reports \"pointer bytes\" used. Pointer bytes is how many bytes of the\nobject that the garbage collector has to potentially scan for pointers, for example:\n\n\tstruct { uint32; string }\n\nhave 16 pointer bytes because the garbage collector has to scan up through the string's\ninner pointer.\n\n\tstruct { string; *uint32 }\n\nhas 24 pointer bytes because it has to scan further through the *uint32.\n\n\tstruct { string; uint32 }\n\nhas 8 because it can stop immediately after the string pointer.\n",
19821996
"default": false
19831997
},
19841998
"fillreturns": {

0 commit comments

Comments
 (0)