Skip to content

Commit

Permalink
Add a config schema
Browse files Browse the repository at this point in the history
This enables auto-completion for the `csharpier` section of `dprint.json`
when using the dprint vscode extension.
  • Loading branch information
Phault committed Feb 24, 2024
1 parent e89977e commit 53e2db7
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ jobs:
id: get_plugin_file_checksum
run: echo "::set-output name=CHECKSUM::$(shasum -a 256 plugin.json | awk '{print $1}')"

- name: Update Config Schema Version
run: 'sed -i '''' ''s/csharpier\/0.0.0/csharpier\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/'' deployment/schema.json'

- name: Create release notes
if: startsWith(github.ref, 'refs/tags/')
run: deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} ${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }} > ${{ github.workspace }}-CHANGELOG.txt
Expand All @@ -93,5 +96,6 @@ jobs:
dprint-plugin-csharpier-aarch64-unknown-linux-musl.zip
dprint-plugin-csharpier-x86_64-pc-windows-msvc.zip
plugin.json
deployment/schema.json
body_path: ${{ github.workspace }}-CHANGELOG.txt
draft: false
2 changes: 1 addition & 1 deletion DprintPluginCsharpier/DprintPluginCsharpier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Dprint.Plugins.Csharpier</RootNamespace>
<AssemblyName>dprint-plugin-csharpier</AssemblyName>
<Nullable>enable</Nullable>
<Version>0.2.1</Version>
<Version>0.2.2</Version>
<Authors>Casper Lindschouw</Authors>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion DprintPluginCsharpier/MessageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private static string GetPluginInfo()
"version": "{{GetAssemblyVersion()}}",
"configKey": "csharpier",
"helpUrl": "https://github.com/Phault/dprint-plugin-csharpier",
"configSchemaUrl": "",
"configSchemaUrl": "https://plugins.dprint.dev/Phault/dprint-plugin-csharpier/{{GetAssemblyVersion()}}/schema.json",
"updateUrl": "https://plugins.dprint.dev/Phault/dprint-plugin-csharpier/latest.json"
}
""";
Expand Down
51 changes: 51 additions & 0 deletions deployment/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://plugins.dprint.dev/Phault/dprint-plugin-csharpier/0.0.0/schema.json",
"type": "object",
"properties": {
"printWidth": {
"description": "Specify at what point the printer will wrap content. This is not a hard limit. Some lines will be shorter or longer.",
"default": 100,
"type": "number"
},
"useTabs": {
"description": "Indent lines with tabs instead of spaces.",
"type": "boolean",
"default": false,
"oneOf": [
{
"const": true,
"description": ""
},
{
"const": false,
"description": ""
}
]
},
"tabWidth": {
"description": "Specify the number of spaces used per indentation level.",
"default": 4,
"type": "number"
},
"endOfLine": {
"description": "The kind of newline to use.",
"type": "string",
"default": "auto",
"oneOf": [
{
"const": "auto",
"description": "Maintain existing line endings (mixed values within one file are normalised by looking at what's used after the first line)"
},
{
"const": "lf",
"description": "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
},
{
"const": "crlf",
"description": "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
}
]
}
}
}

0 comments on commit 53e2db7

Please sign in to comment.