forked from
slices.network/slices
Highly ambitious ATProtocol AppView service and sdks
1# Plugins
2
3Enhance your Slices development workflow with plugins.
4
5## Lexicon IntelliSense
6
7A VS Code extension that provides real-time validation and IntelliSense support
8for AT Protocol lexicon files.
9
10[View on VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=SlicesNetwork.lexicon-intellisense)
11
12### Features
13
14- **Real-time validation**: Validates lexicon files as you type using the
15 `@slices/lexicon` validator
16- **JSON Schema support**: Provides autocomplete and validation for lexicon
17 structure
18- **Cross-lexicon validation**: Validates references between lexicon files in
19 your workspace
20- **Error diagnostics**: Shows validation errors directly in the editor
21
22### Installation
23
24Install from the VS Code marketplace:
25
261. Open VS Code Extensions (Cmd+Shift+X on Mac, Ctrl+Shift+X on Windows/Linux)
272. Search for "Lexicon IntelliSense" by SlicesNetwork
283. Click Install
29
30### Configuration
31
32Configure the extension in VS Code settings:
33
34```json .vscode/settings.json
35{
36 "lexiconIntelliSense.enableValidation": true,
37 "lexiconIntelliSense.lexiconDirectory": "lexicons"
38}
39```
40
41**Settings:**
42
43- `lexiconIntelliSense.enableValidation`: Enable/disable validation (default:
44 `true`)
45- `lexiconIntelliSense.lexiconDirectory`: Directory containing lexicon files
46 relative to workspace root (default: `"lexicons"`)
47
48### Commands
49
50Access these commands via the Command Palette (Cmd+Shift+P):
51
52- **Lexicon: Validate Current File** - Validates the currently open lexicon file
53- **Lexicon: Validate Workspace** - Validates all lexicon files in the workspace
54
55### Usage
56
57The extension automatically activates for:
58
59- JSON files in directories containing "lexicons" in the path
60- JSON files with lexicon structure (containing `id` and `defs` fields)
61
62It validates:
63
64- **Structure**: Required `id` and `defs` fields
65- **Types**: Correct definition types (record, query, procedure, subscription)
66- **References**: Resolvable references to other lexicons
67- **Formats**: String formats like datetime, uri, nsid, at-uri, did
68
69### Example
70
71When editing a lexicon file like `lexicons/com/example/post.json`:
72
73```json lexicons/com/example/post.json
74{
75 "lexicon": 1,
76 "id": "com.example.post",
77 "defs": {
78 "main": {
79 "type": "record",
80 "description": "A blog post",
81 "record": {
82 "type": "object",
83 "required": ["title", "content"],
84 "properties": {
85 "title": {
86 "type": "string",
87 "maxLength": 200
88 },
89 "content": {
90 "type": "string"
91 }
92 }
93 }
94 }
95 }
96}
97```
98
99The extension provides:
100
101- Autocomplete for property types and fields
102- Validation errors for missing required fields
103- Warnings for invalid references
104- IntelliSense for lexicon-specific properties