Skip to content

Commit a30c9a3

Browse files
committed
feat: custom snippets panel description docs
1 parent 613c78b commit a30c9a3

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Custom Snippets
3+
---
4+
5+
import React from 'react';
6+
import VideoPlayer from '@site/src/components/Video/player';
7+
8+
**Custom Snippets** let you create your own reusable code hints. You can define short abbreviations that expand into full code snippets when selected from the suggestions that appear as you type.
9+
10+
You can also specify which file types each snippet should work with, so they appear only where they’re relevant.
11+
12+
Additionally, you can define the cursor position within a snippet. After expansion, **Phoenix Code** automatically places your cursor exactly where you want it, allowing you to start typing right away.
13+
14+
The snippets you define are available globally, so you don’t need to recreate them for every folder. This helps you write code faster and stay consistent across projects.
15+
16+
---
17+
18+
### Custom Snippets Panel
19+
You can manage all your snippets from the **Custom Snippets** panel.
20+
To access it, navigate to `File``Custom Snippets...`.
21+
22+
![Custom Snippets Menu Item](./images/CustomSnippets/custom-snippets-menu-item.png "File > Custom Snippets...")
23+
24+
The panel appears at the bottom of the editor.
25+
26+
![Custom Snippets Panel](./images/CustomSnippets/custom-snippets-empty-panel.png "Custom Snippets panel")
27+
If you haven’t added any snippets yet, the panel will be empty.
28+
29+
---
30+
31+
### Add Snippet
32+
To add a snippet, click on the `'+'` button that appears on the panel header.
33+
> Alternatively, if your snippets panel is empty, **Phoenix Code** shows a large `Add Snippet` button in the panel itself.
34+
35+
![Add Snippet](./images/CustomSnippets/add-snippet.png "Add Snippet")
36+
37+
Clicking on it opens the **Add Snippet** panel.
38+
39+
![Add Snippet Panel](./images/CustomSnippets/add-snippet-panel.png "Add Snippet Panel")
40+
41+
#### Understanding the Add Snippet Panel
42+
The **Add Snippet** panel contains four input fields, each with placeholder examples to guide you:
43+
44+
| Field | Description |
45+
|-------|--------------|
46+
| **Abbreviation** *required* | The shorthand text that triggers your snippet. For example, typing `clg` could expand into a longer code block. |
47+
| **Description** *optional* | A short explanation of what the snippet expands to. This appears in the code hint. Example: *console log shortcut*. |
48+
| **File Extension** *optional* | Specifies which file types the snippet should be active in. For example, `.js, .ts` will make the snippet available in JavaScript and TypeScript files. <br />⚠️ Use file **extensions**, not file or language names, and separate multiple entries with commas. <br /> When left blank, the snippet works for **all** file types. |
49+
| **Template Text** *required* | The actual code or content your snippet expands into. For example, typing `clg` could expand to `console.log();`. |
50+
37.3 KB
Loading
34 KB
Loading
77.9 KB
Loading
74.1 KB
Loading

0 commit comments

Comments
 (0)