You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tools: generate inlay hints settings from gopls settings
This updates the script to generate the inlay hints settings
automatically from gopls. I did some manual touch ups on the settings
from gopls for now and will send a CL to gopls to make the settings
fixes upstream.
Change-Id: Ib4d66b1f03b4e6aa0019d6a9094cc172c8dc952a
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/419120
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
|`run_vulncheck_exp`| Run vulnerability check (`govulncheck`). <br/> Default: `false`|
747
731
|`test`| Runs `go test` for a specific set of test or benchmark functions. <br/> Default: `false`|
748
732
|`tidy`| Runs `go mod tidy` for a module. <br/> Default: `true`|
749
733
|`upgrade_dependency`| Upgrades a dependency in the go.mod file for a module. <br/> Default: `true`|
@@ -837,12 +821,14 @@ Example Usage:
837
821
|`stubmethods`| stub methods analyzer <br/> This analyzer generates method stubs for concrete types in order to implement a target interface <br/> Default: `true`|
838
822
|`testinggoroutine`| report calls to (*testing.T).Fatal from goroutines started by a test. <br/> Functions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and Skip{,f,Now} methods of *testing.T, must be called from the test goroutine itself. This checker detects calls to these functions that occur within a goroutine started by the test. For example: <br/> func TestFoo(t *testing.T) { go func() { t.Fatal("oops") // error: (*T).Fatal called from non-test goroutine }() } <br/> <br/> Default: `true`|
839
823
|`tests`| check for common mistaken usages of tests and examples <br/> The tests checker walks Test, Benchmark and Example functions checking malformed names, wrong signatures and examples documenting non-existent identifiers. <br/> Please see the documentation for package testing in golang.org/pkg/testing for the conventions that are enforced for Tests, Benchmarks, and Examples. <br/> Default: `true`|
824
+
|`timeformat`| check for calls of (time.Time).Format or time.Parse with 2006-02-01 <br/> The timeformat checker looks for time formats with the 2006-02-01 (yyyy-dd-mm) format. Internationally, "yyyy-dd-mm" does not occur in common calendar date standards, and so it is more likely that 2006-01-02 (yyyy-mm-dd) was intended. <br/> <br/> Default: `true`|
840
825
|`undeclaredname`| suggested fixes for "undeclared name: <>" <br/> This checker provides suggested fixes for type errors of the type "undeclared name: <>". It will either insert a new statement, such as: <br/> "<> := " <br/> or a new function declaration, such as: <br/> func <>(inferred parameters) { <pre>panic("implement me!")</pre>} <br/> <br/> Default: `true`|
841
826
|`unmarshal`| report passing non-pointer or non-interface values to unmarshal <br/> The unmarshal analysis reports calls to functions such as json.Unmarshal in which the argument type is not a pointer or an interface. <br/> Default: `true`|
842
827
|`unreachable`| check for unreachable code <br/> The unreachable analyzer finds statements that execution can never reach because they are preceded by an return statement, a call to panic, an infinite loop, or similar constructs. <br/> Default: `true`|
843
828
|`unsafeptr`| check for invalid conversions of uintptr to unsafe.Pointer <br/> The unsafeptr analyzer reports likely incorrect uses of unsafe.Pointer to convert integers to pointers. A conversion from uintptr to unsafe.Pointer is invalid if it implies that there is a uintptr-typed word in memory that holds a pointer value, because that word will be invisible to stack copying and to the garbage collector. <br/> Default: `true`|
844
829
|`unusedparams`| check for unused parameters of functions <br/> The unusedparams analyzer checks functions to see if there are any parameters that are not being used. <br/> To reduce false positives it ignores: - methods - parameters that do not have a name or are underscored - functions in test files - functions with empty bodies or those with just a return stmt <br/> Default: `false`|
845
830
|`unusedresult`| check for unused results of calls to some functions <br/> Some functions like fmt.Errorf return a result and have no side effects, so it is always a mistake to discard the result. This analyzer reports calls to certain functions in which the result of the call is ignored. <br/> The set of functions may be controlled using flags. <br/> Default: `true`|
831
+
|`unusedvariable`| check for unused variables <br/> The unusedvariable analyzer suggests fixes for unused variables errors. <br/> <br/> Default: `false`|
846
832
|`unusedwrite`| checks for unused writes <br/> The analyzer reports instances of writes to struct fields and arrays that are never read. Specifically, when a struct object or an array is copied, its elements are copied implicitly by the compiler, and any element write to this copy does nothing with the original object. <br/> For example: <br/> <pre>type T struct { x int }<br/>func f(input []T) {<br/> for i, v := range input { // v is a copy<br/> v.x = i // unused write to field x<br/> }<br/>}</pre><br/> Another example is about non-pointer receiver: <br/> <pre>type T struct { x int }<br/>func (t T) f() { // t is a copy<br/> t.x = i // unused write to field x<br/>}</pre><br/> <br/> Default: `false`|
847
833
|`useany`| check for constraints that could be simplified to "any" <br/> Default: `false`|
848
834
### `ui.diagnostic.annotations`
@@ -912,6 +898,9 @@ It might be one of:
912
898
913
899
If company chooses to use its own `godoc.org`, its address can be used as well.
914
900
901
+
Modules matching the GOPRIVATE environment variable will not have
902
+
documentation links in hover.
903
+
915
904
916
905
Default: `"pkg.go.dev"`
917
906
### `ui.documentation.linksInHover`
@@ -962,6 +951,18 @@ just "Foo.Field".
962
951
963
952
964
953
Default: `"Dynamic"`
954
+
### `ui.noSemanticNumber`
955
+
956
+
(Experimental) noSemanticNumber turns off the sending of the semantic token 'number'
957
+
958
+
959
+
Default: `false`
960
+
### `ui.noSemanticString`
961
+
962
+
(Experimental) noSemanticString turns off the sending of the semantic token 'string'
963
+
964
+
965
+
Default: `false`
965
966
### `ui.semanticTokens`
966
967
967
968
(Experimental) semanticTokens controls whether the LSP server will send
"markdownDescription": "Enable/disable inlay hints for implicit type parameters on generic functions.\n```go\n\nfunc myFunc[T any](a T) { ... }\n\nfunc main() {\n\tmyFunc/*[int]*/(1)\n}\n```",
2075
-
"default": false
2076
-
},
2077
-
"go.inlayHints.parameterNames": {
2078
-
"type": "boolean",
2079
-
"markdownDescription": "Enable/disable inlay hints for parameter names.\n```go\n\nhttp.HandleFunc(/*pattern:*/ \"/\", /*handler:*/ indexHandler)\n```",
2080
-
"default": false
2081
-
},
2082
-
"go.inlayHints.rangeVariableTypes": {
2083
-
"type": "boolean",
2084
-
"markdownDescription": "Enable/disable inlay hints for variable types in range statements.\n```go\n\nfor k /*int*/, v /*string*/ := range []string{} { ... }\n```",
2085
-
"default": false
2086
-
},
2087
2052
"gopls": {
2088
2053
"type": "object",
2089
2054
"markdownDescription": "Configure the default Go language server ('gopls'). In most cases, configuring this section is unnecessary. See [the documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md) for all available settings.",
"markdownDescription": "Runs `go test` for a specific set of test or benchmark functions.",
@@ -2442,6 +2412,11 @@
2442
2412
"markdownDescription": "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
2443
2413
"default": true
2444
2414
},
2415
+
"timeformat": {
2416
+
"type": "boolean",
2417
+
"markdownDescription": "check for calls of (time.Time).Format or time.Parse with 2006-02-01\n\nThe timeformat checker looks for time formats with the 2006-02-01 (yyyy-dd-mm)\nformat. Internationally, \"yyyy-dd-mm\" does not occur in common calendar date\nstandards, and so it is more likely that 2006-01-02 (yyyy-mm-dd) was intended.\n",
2418
+
"default": true
2419
+
},
2445
2420
"undeclaredname": {
2446
2421
"type": "boolean",
2447
2422
"markdownDescription": "suggested fixes for \"undeclared name: <>\"\n\nThis checker provides suggested fixes for type errors of the\ntype \"undeclared name: <>\". It will either insert a new statement,\nsuch as:\n\n\"<> := \"\n\nor a new function declaration, such as:\n\nfunc <>(inferred parameters) {\n\tpanic(\"implement me!\")\n}\n",
@@ -2472,6 +2447,11 @@
2472
2447
"markdownDescription": "check for unused results of calls to some functions\n\nSome functions like fmt.Errorf return a result and have no side effects,\nso it is always a mistake to discard the result. This analyzer reports\ncalls to certain functions in which the result of the call is ignored.\n\nThe set of functions may be controlled using flags.",
2473
2448
"default": true
2474
2449
},
2450
+
"unusedvariable": {
2451
+
"type": "boolean",
2452
+
"markdownDescription": "check for unused variables\n\nThe unusedvariable analyzer suggests fixes for unused variables errors.\n",
2453
+
"default": false
2454
+
},
2475
2455
"unusedwrite": {
2476
2456
"type": "boolean",
2477
2457
"markdownDescription": "checks for unused writes\n\nThe analyzer reports instances of writes to struct fields and\narrays that are never read. Specifically, when a struct object\nor an array is copied, its elements are copied implicitly by\nthe compiler, and any element write to this copy does nothing\nwith the original object.\n\nFor example:\n\n\ttype T struct { x int }\n\tfunc f(input []T) {\n\t\tfor i, v := range input { // v is a copy\n\t\t\tv.x = i // unused write to field x\n\t\t}\n\t}\n\nAnother example is about non-pointer receiver:\n\n\ttype T struct { x int }\n\tfunc (t T) f() { // t is a copy\n\t\tt.x = i // unused write to field x\n\t}\n",
@@ -2551,7 +2531,7 @@
2551
2531
},
2552
2532
"ui.documentation.linkTarget": {
2553
2533
"type": "string",
2554
-
"markdownDescription": "linkTarget controls where documentation links go.\nIt might be one of:\n\n* `\"godoc.org\"`\n* `\"pkg.go.dev\"`\n\nIf company chooses to use its own `godoc.org`, its address can be used as well.\n",
2534
+
"markdownDescription": "linkTarget controls where documentation links go.\nIt might be one of:\n\n* `\"godoc.org\"`\n* `\"pkg.go.dev\"`\n\nIf company chooses to use its own `godoc.org`, its address can be used as well.\n\nModules matching the GOPRIVATE environment variable will not have\ndocumentation links in hover.\n",
2555
2535
"default": "pkg.go.dev",
2556
2536
"scope": "resource"
2557
2537
},
@@ -2611,6 +2591,18 @@
2611
2591
"default": "Dynamic",
2612
2592
"scope": "resource"
2613
2593
},
2594
+
"ui.noSemanticNumber": {
2595
+
"type": "boolean",
2596
+
"markdownDescription": "(Experimental) noSemanticNumber turns off the sending of the semantic token 'number'\n",
2597
+
"default": false,
2598
+
"scope": "resource"
2599
+
},
2600
+
"ui.noSemanticString": {
2601
+
"type": "boolean",
2602
+
"markdownDescription": "(Experimental) noSemanticString turns off the sending of the semantic token 'string'\n",
2603
+
"default": false,
2604
+
"scope": "resource"
2605
+
},
2614
2606
"ui.semanticTokens": {
2615
2607
"type": "boolean",
2616
2608
"markdownDescription": "(Experimental) semanticTokens controls whether the LSP server will send\nsemantic tokens to the client.\n",
@@ -2624,6 +2616,41 @@
2624
2616
"scope": "resource"
2625
2617
}
2626
2618
}
2619
+
},
2620
+
"go.inlayHints.assignVariableTypes": {
2621
+
"type": "boolean",
2622
+
"markdownDescription": "Enable/disable inlay hints for variable types in assign statements:\n```go\n\ti/* int*/, j/* int*/ := 0, len(r)-1\n```",
2623
+
"default": false
2624
+
},
2625
+
"go.inlayHints.compositeLiteralFields": {
2626
+
"type": "boolean",
2627
+
"markdownDescription": "Enable/disable inlay hints for composite literal field names:\n```go\n\t{/*in: */\"Hello, world\", /*want: */\"dlrow ,olleH\"}\n```",
2628
+
"default": false
2629
+
},
2630
+
"go.inlayHints.compositeLiteralTypes": {
2631
+
"type": "boolean",
2632
+
"markdownDescription": "Enable/disable inlay hints for composite literal types:\n```go\n\tfor _, c := range []struct {\n\t\tin, want string\n\t}{\n\t\t/*struct{ in string; want string }*/{\"Hello, world\", \"dlrow ,olleH\"},\n\t}\n```",
"markdownDescription": "Enable/disable inlay hints for implicit type parameters on generic functions:\n```go\n\tmyFoo/*[int, string]*/(1, \"hello\")\n```",
"markdownDescription": "Enable/disable inlay hints for variable types in range statements:\n```go\n\tfor k/* int*/, v/* string*/ := range []string{} {\n\t\tfmt.Println(k, v)\n\t}\n```",
0 commit comments