1# Snippets
2
3Use the {#action snippets::ConfigureSnippets} action to create a new snippets file or edit an existing snippets file for a specified [scope](#scopes).
4
5The snippets are located in `~/.config/zed/snippets` directory to which you can navigate to with the {#action snippets::OpenFolder} action.
6
7## Example configuration
8
9```json [settings]
10{
11 // Each snippet must have a name and body, but the prefix and description are optional.
12 // The prefix is used to trigger the snippet, but when omitted then the name is used.
13 // Use placeholders like $1, $2 or ${1:defaultValue} to define tab stops.
14 // The $0 determines the final cursor position.
15 // Placeholders with the same value are linked.
16 "Log to console": {
17 "prefix": "log",
18 "body": ["console.info(\"Hello, ${1:World}!\")", "$0"],
19 "description": "Logs to console"
20 }
21}
22```
23
24## Scopes
25
26The scope is determined by the language name in lowercase e.g. `python.json` for Python, `shell script.json` for Shell Script, but there are some exceptions to this rule:
27
28| Scope | Filename |
29| ---------- | --------------- |
30| Global | snippets.json |
31| JSX | javascript.json |
32| Plain Text | plaintext.json |
33
34To create JSX snippets you have to use `javascript.json` snippets file, instead of `jsx.json`, but this does not apply to TSX and TypeScript which follow the above rule.
35
36## Known Limitations
37
38- Only the first prefix is used when an list of prefixes is passed in.
39- Currently only the `json` snippet file format is supported, even though the `simple-completion-language-server` supports both `json` and `toml` file formats.
40
41## See also
42
43The `feature_paths` option in `simple-completion-language-server` is disabled by default.
44
45If you want to enable it you can add the following to your `settings.json`:
46
47```json [settings]
48{
49 "lsp": {
50 "snippet-completion-server": {
51 "settings": {
52 "feature_paths": true
53 }
54 }
55 }
56}
57```
58
59For more configuration information, see the [`simple-completion-language-server` instructions](https://github.com/zed-industries/simple-completion-language-server/tree/main).