Skip to content

Commit 173a646

Browse files
committed
add installation and usage
1 parent 55d256b commit 173a646

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,37 @@
22
A simple language server to just insert snippets into Helix (and other text editor, IDE)
33

44
https://quantonganh.com/2023/07/31/create-snippets-in-helix
5+
6+
## Installation
7+
8+
### Install via go
9+
10+
Due to the presence of a `replace` directive in the [go.mod](https://github.com/quantonganh/snippets-ls/blob/main/go.mod#L13) file, [`go install` cannot be used](https://github.com/golang/go/issues/44840). You have to clone and build the package manually:
11+
12+
```sh
13+
$ git clone git@github.com:quantonganh/snippets-ls.git
14+
$ cd snippets-ls
15+
$ go build -o ~/go/bin/snippets-ls main.go
16+
```
17+
18+
Don't forget to append `~/go/bin` to your `$PATH`.
19+
20+
## Usage
21+
22+
Create your own snippets follow [VSCode syntax](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets). Alternatively, you can make use of [pre-existing](https://github.com/microsoft/vscode-go/blob/master/snippets/go.json) [sample](https://github.com/rust-lang/vscode-rust/blob/master/snippets/rust.json) for various programming languages.
23+
24+
Update your configuration file located at `~/.config/helix/languages.toml`:
25+
26+
```toml
27+
[[language]]
28+
name = "go"
29+
formatter = { command = "goimports"}
30+
language-servers = ["gopls", "snippets-ls"]
31+
32+
[language-server.snippets-ls]
33+
command = "snippets-ls"
34+
args = ["-config", "/Users/quantong/.config/helix/go-snippets.json"]
35+
```
36+
37+
Subsequently, as you start working on your file, input a snippet prefix to observe the suggestion.
38+
If it does not work, take a look at `~/.cache/helix/helix.log` for additional insights.

0 commit comments

Comments
 (0)