Skip to content

Commit 8cacb4f

Browse files
authored
Merge pull request #90 from Flow-Launcher/add-json-schema-info
Add information on using JSON schemas
2 parents 96c3257 + df8fdfe commit 8cacb4f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

json-rpc-settings.md

+7
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ body:
183183
<settings-component-demo type="dropdown" label="Programming language to prefer for answers" value="TypeScript" options='["JavaScript", "TypeScript", "Python", "C#"]'></settings-component-demo>
184184
<settings-component-demo type="checkbox" label="Prefer shorter answers" description="If checked, the plugin will try to give answer much shorter than the usual ones."></settings-component-demo>
185185

186+
### JSON Schema
187+
Add the following line at the beginning of your `SettingsTemplate.yaml` file to enable validation and auto-completion in your IDE. Unfortunately, this feature is supported only in JetBrains IDEs (WebStorm, PhpStorm, Rider, etc.) and does not work in Visual Studio or Visual Studio Code. Please note that it must start with `#` as it must be a comment, otherwise Flow Launcher won't be able to parse the file.
188+
189+
```yaml
190+
#$schema: https://www.flowlauncher.com/schemas/settings-template.schema.json
191+
```
192+
186193
### Visual editor for `SettingsTemplate.yaml`
187194
You can use a [visual editor](/json-rpc-visual-settingstemplate-editor.md) for creating the `SettingsTemplate.yaml` file. When you're done editing, click the `Generate SettingsTemplate.yaml` file and copy-paste its contents into your `SettingsTemplate.yaml` file. Optionally, you can also copy the generated typings for your settings object in your preferred programming language.
188195

plugin.json.md

+13
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ It must be in the plugin root directory.
1717
"ExecuteFileName":"" //Execution entry. dll extension for C#/F# plugin, .py for python plugin, .js/.ts for JS/TS plugins and .exe or other executable for executable plugin. Path examples include "main.py" or "./dist/main.js"
1818
}
1919
```
20+
21+
## JSON Schema
22+
Additionally, you can add a property called `$schema` to enable validation and auto-completion in your IDE. This works in JetBrains IDEs (i.e., WebStorm, PhpStorm, Rider, etc.), Visual Studio, and Visual Studio Code. Add this property to the top of the JSON file:
23+
24+
```js
25+
{
26+
"$schema": "https://www.flowlauncher.com/schemas/plugin.schema.json",
27+
// the rest of the plugin.json file
28+
// ...
29+
}
30+
```
31+
32+
Now you should have auto-completion and file validation available for you in your IDE.

0 commit comments

Comments
 (0)