Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Pradumnasaraf/e26e21c13272167bba8aab361e8c455f to your computer and use it in GitHub Desktop.
Save Pradumnasaraf/e26e21c13272167bba8aab361e8c455f to your computer and use it in GitHub Desktop.
// Tags and options configured here will be used by the Add Tags command to add tags to struct fields. If promptForTags is true, then user will be prompted for tags and options. By default, json tags are added.
"go.addTags": {
"tags": "json",
"options": "json=omitempty",
"promptForTags": false,
"transform": "snakecase",
"template": ""
},
// Alternate tools or alternate paths for the same tools used by the Go extension. Provide either absolute path or the name of the binary in GOPATH/bin, GOROOT/bin or PATH. Useful when you want to use wrapper script for the Go tools.
"go.alternateTools": {},
// Code completion without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`).
// Include unimported packages in auto-complete suggestions. Not applicable when using the language server.
"go.autocompleteUnimportedPackages": false,
// Flags to `go build`/`go test` used during build-on-save or running tests. (e.g. ["-ldflags='-s'"]) This is propagated to the language server if `gopls.build.buildFlags` is not specified.
"go.buildFlags": [],
// Enable the Go language server (`go.useLanguageServer`) to diagnose compile errors.
// Compiles code on file save using 'go build' or 'go test -c'. Not applicable when using the language server.
"go.buildOnSave": "package",
// The Go build tags to use for all commands, that support a `-tags '...'` argument. When running tests, go.testTags will be used instead if it was set. This is propagated to the language server if `gopls.build.buildFlags` is not specified.
"go.buildTags": "",
// This option lets you choose the way to display code coverage. Choose either to highlight the complete line or to show a decorator in the gutter. You can customize the colors and borders for the former and the style for the latter.
"go.coverageDecorator": {
"type": "highlight",
"coveredHighlightColor": "rgba(64,128,128,0.5)",
"uncoveredHighlightColor": "rgba(128,64,64,0.25)",
"coveredBorderColor": "rgba(64,128,128,0.5)",
"uncoveredBorderColor": "rgba(128,64,64,0.25)",
"coveredGutterStyle": "blockblue",
"uncoveredGutterStyle": "slashyellow"
},
// Use these options to control whether only covered or only uncovered code or both should be highlighted after running test coverage
"go.coverageOptions": "showBothCoveredAndUncoveredCode",
// When generating code coverage, the value for -covermode. 'default' is the default value chosen by the 'go test' command.
"go.coverMode": "default",
// If true, runs 'go test -coverprofile' on save and shows test coverage.
"go.coverOnSave": false,
// If true, shows test coverage when Go: Test Function at cursor command is run.
"go.coverOnSingleTest": false,
// If true, shows test coverage when Go: Test Single File command is run.
"go.coverOnSingleTestFile": false,
// If true, shows test coverage when Go: Test Package command is run.
"go.coverOnTestPackage": true,
// When generating code coverage, should counts be shown as --374--
"go.coverShowCounts": false,
// Delve settings that applies to all debugging sessions. Debug configuration in the launch.json file will override these values.
"go.delveConfig": {},
// (Experimental) vulncheck enables vulnerability scanning.
//
// - Imports: `"Imports"`: In Imports mode, `gopls` will report vulnerabilities that affect packages
// directly and indirectly used by the analyzed main module.
//
// - Off: `"Off"`: Disable vulnerability analysis.
//
"go.diagnostic.vulncheck": "Off",
// If true, tests will not run concurrently. When a new test run is started, the previous will be cancelled.
"go.disableConcurrentTests": false,
// Documentation support without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`).
// Pick 'godoc' or 'gogetdoc' to get documentation. Not applicable when using the language server.
"go.docsTool": "godoc",
// Experimental Feature: Enable/Disable entries from the context menu in the editor.
"go.editorContextMenuCommands": {
"toggleTestFile": true,
"addTags": true,
"removeTags": false,
"fillStruct": false,
"testAtCursor": true,
"testFile": false,
"testPackage": false,
"generateTestForFunction": true,
"generateTestForFile": false,
"generateTestForPackage": false,
"addImport": true,
"testCoverage": true,
"playground": true,
"debugTestAtCursor": true,
"benchmarkAtCursor": false
},
// Feature level setting to enable/disable code lens for references and run/debug tests
"go.enableCodeLens": {
"runtest": true
},
// Flags to pass to format tool (e.g. ["-s"]). Not applicable when using the language server.
"go.formatFlags": [],
// When the language server is enabled and one of `default`/`gofmt`/`goimports`/`gofumpt` is chosen, the language server will handle formatting. If `custom` tool is selected, the extension will use the `customFormatter` tool in the `go.alternateTools` section.
// - default: If the language server is enabled, format via the language server, which already supports gofmt, goimports, goreturns, and gofumpt. Otherwise, goimports.
// - gofmt: Formats the file according to the standard Go style. (not applicable when the language server is enabled)
// - goimports: Organizes imports and formats the file with gofmt. (not applicable when the language server is enabled)
// - goformat: Configurable gofmt, see https://github.com/mbenkmann/goformat.
// - gofumpt: Stricter version of gofmt, see https://github.com/mvdan/gofumpt. . Use `gopls.format.gofumpt` instead)
// - custom: Formats using the custom tool specified as `customFormatter` in the `go.alternateTools` setting. The tool should take the input as STDIN and output the formatted code as STDOUT.
"go.formatTool": "default",
// Additional command line flags to pass to `gotests` for generating tests.
"go.generateTestsFlags": [],
// `gocode` is deprecated by the Go language server. Enable the Go language server (`go.useLanguageServer`).
// Enable gocode's autobuild feature. Not applicable when using the language server.
"go.gocodeAutoBuild": false,
// `gocode` is deprecated by the Go language server. Enable the Go language server (`go.useLanguageServer`).
// Additional flags to pass to gocode. Not applicable when using the language server.
"go.gocodeFlags": [
"-builtin",
"-ignore-case",
"-unimported-packages"
],
// `gocode` is deprecated by the Go language server. Enable the Go language server (`go.useLanguageServer`).
// Used to determine the Go package lookup rules for completions by gocode. Not applicable when using the language server.
"go.gocodePackageLookupMode": "go",
// Specify GOPATH here to override the one that is set as environment variable. The inferred GOPATH from workspace root overrides this, if go.inferGopath is set to true.
"go.gopath": null,
// Specifies the GOROOT to use when no environment variable is set.
"go.goroot": null,
// Code navigation without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`).
// Folder names (not paths) to ignore while using Go to Symbol in Workspace feature. Not applicable when using the language server.
"go.gotoSymbol.ignoreFolders": [],
// Code navigation without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`).
// If false, the standard library located at $GOROOT will be excluded while using the Go to Symbol in File feature. Not applicable when using the language server.
"go.gotoSymbol.includeGoroot": false,
// Code navigation without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`).
// If false, the import statements will be excluded while using the Go to Symbol in File feature. Not applicable when using the language server.
"go.gotoSymbol.includeImports": false,
// Infer GOPATH from the workspace root. This is ignored when using Go Modules.
"go.inferGopath": false,
// Enable/disable inlay hints for variable types in assign statements:
// ```go
// i/* int*/, j/* int*/ := 0, len(r)-1
// ```
"go.inlayHints.assignVariableTypes": false,
// Enable/disable inlay hints for composite literal field names:
// ```go
// {/*in: */"Hello, world", /*want: */"dlrow ,olleH"}
// ```
"go.inlayHints.compositeLiteralFields": false,
// Enable/disable inlay hints for composite literal types:
// ```go
// for _, c := range []struct {
// in, want string
// }{
// /*struct{ in string; want string }*/{"Hello, world", "dlrow ,olleH"},
// }
// ```
"go.inlayHints.compositeLiteralTypes": false,
// Enable/disable inlay hints for constant values:
// ```go
// const (
// KindNone Kind = iota/* = 0*/
// KindPrint/* = 1*/
// KindPrintf/* = 2*/
// KindErrorf/* = 3*/
// )
// ```
"go.inlayHints.constantValues": false,
// Enable/disable inlay hints for implicit type parameters on generic functions:
// ```go
// myFoo/*[int, string]*/(1, "hello")
// ```
"go.inlayHints.functionTypeParameters": false,
// Enable/disable inlay hints for parameter names:
// ```go
// parseInt(/* str: */ "123", /* radix: */ 8)
// ```
"go.inlayHints.parameterNames": false,
// Enable/disable inlay hints for variable types in range statements:
// ```go
// for k/* int*/, v/* string*/ := range []string{} {
// fmt.Println(k, v)
// }
// ```
"go.inlayHints.rangeVariableTypes": false,
// If true, then `-i` flag will be passed to `go build` everytime the code is compiled. Since Go 1.10, setting this may be unnecessary unless you are in GOPATH mode and do not use the language server.
"go.installDependenciesWhenBuilding": false,
// Flags like -rpc.trace and -logfile to be used while running the language server.
"go.languageServerFlags": [],
// Flags to pass to Lint tool (e.g. ["-min_confidence=.8"])
"go.lintFlags": [],
// Lints code on file save using the configured Lint tool. Options are 'file', 'package', 'workspace' or 'off'.
// - file: lint the current file on file saving
// - package: lint the current package on file saving
// - workspace: lint all the packages in the current workspace root folder on file saving
// - off: do not run lint automatically
"go.lintOnSave": "package",
// Specifies Lint tool name.
"go.lintTool": "staticcheck",
// Real-time diagnostics without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`).
// Use gotype on the file currently being edited and report any semantic or syntactic errors found after configured delay. Not applicable when using the language server.
"go.liveErrors": {
"enabled": false,
"delay": 500
},
// The logging level the extension logs at, defaults to 'error'
"go.logging.level": "error",
// The flags configured here will be passed through to command `goplay`
"go.playground": {
"openbrowser": true,
"share": true,
"run": true
},
// Tags and options configured here will be used by the Remove Tags command to remove tags to struct fields. If promptForTags is true, then user will be prompted for tags and options. By default, all tags and options will be removed.
"go.removeTags": {
"tags": "",
"options": "",
"promptForTags": false
},
// Specifies whether to show the Welcome experience on first install
"go.showWelcome": true,
// Prompt for surveys, including the gopls survey and the Go developer survey.
"go.survey.prompt": true,
// enable the default go build/test task provider.
"go.tasks.provideDefault": true,
// Apply the Go & PATH environment variables used by the extension to all integrated terminals.
"go.terminal.activateEnvironment": true,
// Absolute path to a file containing environment variables definitions. File contents should be of the form key=value.
"go.testEnvFile": null,
// Environment variables that will be passed to the process that runs the Go tests
"go.testEnvVars": {},
// Run benchmarks when running all tests in a file or folder.
"go.testExplorer.alwaysRunBenchmarks": false,
// Concatenate all test log messages for a given location into a single message.
"go.testExplorer.concatenateMessages": true,
// Enable the Go test explorer
"go.testExplorer.enable": true,
// Present packages in the test explorer flat or nested.
"go.testExplorer.packageDisplayMode": "flat",
// Set the source location of dynamically discovered subtests to the location of the containing function. As a result, dynamically discovered subtests will be added to the gutter test widget of the containing function.
"go.testExplorer.showDynamicSubtestsInEditor": false,
// Open the test output terminal when a test run is started.
"go.testExplorer.showOutput": true,
// Flags to pass to `go test`. If null, then buildFlags will be used. This is not propagated to the language server.
"go.testFlags": null,
// Run 'go test' on save for current package. It is not advised to set this to `true` when you have Auto Save enabled.
"go.testOnSave": false,
// The Go build tags to use for when running tests. If null, then buildTags will be used.
"go.testTags": null,
// Specifies the timeout for go test in ParseDuration format.
"go.testTimeout": "30s",
// Environment variables that will be passed to the tools that run the Go tools (e.g. CGO_CFLAGS) and debuggee process launched by Delve. Format as string key:value pairs. When debugging, merged with `envFile` and `env` values with precedence `env` > `envFile` > `go.toolsEnvVars`.
"go.toolsEnvVars": {},
// Location to install the Go tools that the extension depends on if you don't want them in your GOPATH.
"go.toolsGopath": null,
// Automatically update the tools used by the extension, without prompting the user.
"go.toolsManagement.autoUpdate": false,
// Specify whether to prompt about new versions of Go and the Go tools (currently, only `gopls`) the extension depends on
// - proxy: keeps notified of new releases by checking the Go module proxy (GOPROXY)
// - local: checks only the minimum tools versions required by the extension
// - off: completely disables version check (not recommended)
"go.toolsManagement.checkForUpdates": "proxy",
// The path to the `go` binary used to install the Go tools. If it's empty, the same `go` binary chosen for the project will be used for tool installation.
"go.toolsManagement.go": "",
// Trace the communication between VS Code and the Go language server.
"go.trace.server": "off",
// Code completion without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`) and use [`gopls's `ui.completion.usePlaceholders` setting](https://github.com/golang/vscode-go/wiki/settings#uicompletionuseplaceholders) instead.
// Complete functions with their parameter signature, including the variable type. Not propagated to the language server.
"go.useCodeSnippetsOnFunctionSuggest": false,
// Code completion without the language server is deprecated. Enable the Go language server (`go.useLanguageServer`) and use [`gopls's `ui.completion.usePlaceholders` setting](https://github.com/golang/vscode-go/wiki/settings#uicompletionuseplaceholders) instead.
// Complete functions with their parameter signature, excluding the variable types. Use `gopls.usePlaceholders` when using the language server.
"go.useCodeSnippetsOnFunctionSuggestWithoutType": false,
// Use `go.toolsManagement.checkForUpdates` instead.
// When enabled, the extension automatically checks the Go proxy if there are updates available for Go and the Go tools (at present, only gopls) it depends on and prompts the user accordingly
"go.useGoProxyToCheckForToolUpdates": true,
// Enable intellisense, code navigation, refactoring, formatting & diagnostics for Go. The features are powered by the Go language server "gopls".
"go.useLanguageServer": true,
// Flags to pass to `go tool vet` (e.g. ["-all", "-shadow"])
"go.vetFlags": [],
// Vets code on file save using 'go tool vet'. Not applicable when using the language server's diagnostics. See 'go.languageServerExperimentalFeatures.diagnostics' setting.
// - package: vet the current package on file saving
// - workspace: vet all the packages in the current workspace root folder on file saving
// - off: do not run vet automatically
"go.vetOnSave": "package",
// 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.
"gopls": {},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment