Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pieterclaerhout/vscode-snippets
Snippets I'm using for Visual Studio Code
https://github.com/pieterclaerhout/vscode-snippets
golang vscode vscode-snippets
Last synced: 9 days ago
JSON representation
Snippets I'm using for Visual Studio Code
- Host: GitHub
- URL: https://github.com/pieterclaerhout/vscode-snippets
- Owner: pieterclaerhout
- License: apache-2.0
- Created: 2019-09-28T13:26:18.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-29T18:01:49.000Z (9 months ago)
- Last Synced: 2024-02-29T19:25:02.147Z (9 months ago)
- Topics: golang, vscode, vscode-snippets
- Size: 896 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Snippets for Visual Studio Code
[![license](https://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://github.com/pieterclaerhout/vscode-snippets/raw/master/LICENSE) [![GitHub version](https://badge.fury.io/gh/pieterclaerhout%2Fvscode-snippets.svg)](https://badge.fury.io/gh/pieterclaerhout%2Fvscode-snippets)
These are some of the [custom snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets) I'm using for [Visual Studio Code](https://code.visualstudio.com).
## How to install
Just place the desired Go file in:
- macOS: ~/Library/Application Support/Code/User/snippets
- Windows: %HOMEPATH%\AppData\Roaming\Code\User\snippets## Go Snippets
For [Go](https://golang.org), I have two snippets defined:
### `tcimp`
You can use the `tcimp` snippet to quickly add the basic imports needed for writing a test.
It uses the [`testing`](https://golang.org/pkg/testing/) and [`assert`](https://github.com/stretchr/testify#assert-package) libaries.
Just type `tcimp` and you'll get the following snippet:
```go
import (
"testing""github.com/stretchr/testify/assert"
"github.com/"
)
```![`tcimp` snippet](https://github.com/pieterclaerhout/vscode-snippets/blob/master/images/vscode_snippet_tcimp.png?raw=true)
### `tc`
Typing `tc` sets up the basic structure for an empty test and results in:
```go
func Test_(t *testing.T) {type test struct {
name string
}var tests = []test{}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
})
}}
```![`tc` snippet](https://github.com/pieterclaerhout/vscode-snippets/blob/master/images/vscode_snippet_tc.png?raw=true)