golang.org/x/tools/gopls@v0.15.3/doc/inlayHints.md (about)

     1  # Hints
     2  
     3  This document describes the inlay hints that `gopls` uses inside the editor.
     4  
     5  <!-- BEGIN Hints: DO NOT MANUALLY EDIT THIS SECTION -->
     6  ## **assignVariableTypes**
     7  
     8  Enable/disable inlay hints for variable types in assign statements:
     9  ```go
    10  	i/* int*/, j/* int*/ := 0, len(r)-1
    11  ```
    12  
    13  **Disabled by default. Enable it by setting `"hints": {"assignVariableTypes": true}`.**
    14  
    15  ## **compositeLiteralFields**
    16  
    17  Enable/disable inlay hints for composite literal field names:
    18  ```go
    19  	{/*in: */"Hello, world", /*want: */"dlrow ,olleH"}
    20  ```
    21  
    22  **Disabled by default. Enable it by setting `"hints": {"compositeLiteralFields": true}`.**
    23  
    24  ## **compositeLiteralTypes**
    25  
    26  Enable/disable inlay hints for composite literal types:
    27  ```go
    28  	for _, c := range []struct {
    29  		in, want string
    30  	}{
    31  		/*struct{ in string; want string }*/{"Hello, world", "dlrow ,olleH"},
    32  	}
    33  ```
    34  
    35  **Disabled by default. Enable it by setting `"hints": {"compositeLiteralTypes": true}`.**
    36  
    37  ## **constantValues**
    38  
    39  Enable/disable inlay hints for constant values:
    40  ```go
    41  	const (
    42  		KindNone   Kind = iota/* = 0*/
    43  		KindPrint/*  = 1*/
    44  		KindPrintf/* = 2*/
    45  		KindErrorf/* = 3*/
    46  	)
    47  ```
    48  
    49  **Disabled by default. Enable it by setting `"hints": {"constantValues": true}`.**
    50  
    51  ## **functionTypeParameters**
    52  
    53  Enable/disable inlay hints for implicit type parameters on generic functions:
    54  ```go
    55  	myFoo/*[int, string]*/(1, "hello")
    56  ```
    57  
    58  **Disabled by default. Enable it by setting `"hints": {"functionTypeParameters": true}`.**
    59  
    60  ## **parameterNames**
    61  
    62  Enable/disable inlay hints for parameter names:
    63  ```go
    64  	parseInt(/* str: */ "123", /* radix: */ 8)
    65  ```
    66  
    67  **Disabled by default. Enable it by setting `"hints": {"parameterNames": true}`.**
    68  
    69  ## **rangeVariableTypes**
    70  
    71  Enable/disable inlay hints for variable types in range statements:
    72  ```go
    73  	for k/* int*/, v/* string*/ := range []string{} {
    74  		fmt.Println(k, v)
    75  	}
    76  ```
    77  
    78  **Disabled by default. Enable it by setting `"hints": {"rangeVariableTypes": true}`.**
    79  
    80  <!-- END Hints: DO NOT MANUALLY EDIT THIS SECTION -->