Created
May 22, 2019 02:17
-
-
Save rectcircle/55874919add4157e9808b776b15c40a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"title": "Template Config", | |
"description": "vscode extension new-file-by-type config schema", | |
"type": "object", | |
"definitions": { | |
"StringOrStringArray": { | |
"anyOf": [{ | |
"type": "string" | |
}, | |
{ | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
} | |
] | |
}, | |
"Input": { | |
"type": "object", | |
"properties": { | |
"type": { | |
"enum": ["path", "text"], | |
"description": "input type", | |
"default": "text" | |
}, | |
"name": { | |
"type": "string", | |
"description": "input name" | |
}, | |
"prompt": { | |
"type": "string", | |
"default": "{{i18n('pathInputPrompt')}}" | |
}, | |
"placeHolder": { | |
"type": "string", | |
"default": "{{i18n('pathInputPlaceHolder')}}" | |
}, | |
"suggest": { | |
"type": "object", | |
"properties": { | |
"selected":{ | |
"type": "boolean", | |
"default": true | |
}, | |
"value": { | |
"$ref": "#/definitions/StringOrStringArray" | |
} | |
} | |
}, | |
"check": { | |
"$ref": "#/definitions/StringOrStringArray" | |
}, | |
"option": { | |
"type": "object", | |
"properties": { | |
"parentDirectoryText":{ | |
"type":"string", | |
"default": "{{i18n('pathInputParentDirectoryText')}}" | |
}, | |
"pathSeparator": { | |
"type": "string", | |
"default": "/" | |
}, | |
"confirmText": { | |
"type": "string", | |
"default": "{{i18n('pathInputConfirmText')}" | |
}, | |
"suggestText": { | |
"type": "string", | |
"default": "{{i18n('pathInputSuggestText')}}" | |
}, | |
"directoryText": { | |
"type": "string", | |
"default": "{{i18n('pathInputDirectoryText')}}" | |
}, | |
"fileText": { | |
"type": "string", | |
"default": "{{i18n('pathInputFileText')}}" | |
}, | |
"confirmDetailText": { | |
"type": "string", | |
"default": "{{i18n('pathInputConfirmDetailText')}}" | |
}, | |
"currentDirectoryText": { | |
"type": "string", | |
"default": "{{i18n('pathInputCurrentDirectoryText')}}" | |
}, | |
"allowNoExist": { | |
"type": "boolean", | |
"default": "true" | |
}, | |
"resultExistAndTypeErrorText": { | |
"type": "string", | |
"default": "{{i18n('pathInputResultExistAndTypeErrorText')}}" | |
}, | |
"returnType": { | |
"enum": ["file" , "directory" , "all"], | |
"default": "directory" | |
}, | |
"basePath": { | |
"type": "string", | |
"default": "{{projectFolder}}" | |
} | |
} | |
} | |
}, | |
"required": ["type", "name"] | |
} | |
}, | |
"properties": { | |
"name": { | |
"description": "template or type name", | |
"type": "string", | |
"default": "{{ i18n('name') }}" | |
}, | |
"description": { | |
"description": "template or type name", | |
"type": "string", | |
"default": "{{ i18n('description') }}" | |
}, | |
"version": { | |
"description": "default version will use in comment", | |
"type": "string", | |
"default": "0.0.1" | |
}, | |
"flat": { | |
"description": "subtype flat display", | |
"type": "boolean", | |
"default": false | |
}, | |
"indent": { | |
"description": "file indent type: 0 - use [Tab], non-zero - use `indent` number space", | |
"default": "{{defaultConf.indent}}", | |
"oneOf": [ | |
{ | |
"type": "number" | |
}, | |
{ | |
"type": "string" | |
} | |
] | |
}, | |
"encoding": { | |
"type": "string", | |
"description": "file encoding", | |
"default": "{{defaultConf.encoding}}" | |
}, | |
"suffix": { | |
"description": "file suffix", | |
"type": "string", | |
"default": "" | |
}, | |
"targets": { | |
"description": "template file path and output path config", | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"filepath": { | |
"description": "target file path to generate", | |
"type": "string", | |
"default": "{{ inputs.path.resolve(projectFolder, inputs.filename + ( suffix ? '.' + suffix : '') )}}" | |
}, | |
"tplpath": { | |
"description": "template file path", | |
"type": "string", | |
"default": "tpl" | |
} | |
} | |
} | |
}, | |
"placeHolder": { | |
"description": "template select view placeHolder text", | |
"type": "string", | |
"default": "{{i18n('templateSelectPlaceHolder')}}" | |
}, | |
"inputs": { | |
"type": "array", | |
"default": [ | |
{ | |
"type": "path", | |
"name": "srcPath", | |
"prompt": "{{i18n('pathInputPrompt')}}", | |
"placeHolder": "{{i18n('pathInputPlaceHolder')}}", | |
"suggest": { | |
"selected": true, | |
"value": [ | |
"src/main/java/", | |
"src/test/java/", | |
"src/" | |
] | |
}, | |
"option": { | |
"parentDirectoryText": "{{i18n('pathInputParentDirectoryText')}}", | |
"pathSeparator": "/", | |
"confirmText": "{{i18n('pathInputConfirmText')}}", | |
"suggestText": "{{i18n('pathInputSuggestText')}}", | |
"directoryText": "{{i18n('pathInputDirectoryText')}}", | |
"confirmDetailText": "{{i18n('pathInputConfirmDetailText')}}", | |
"currentDirectoryText": "{{i18n('pathInputCurrentDirectoryText')}}" | |
} | |
}, | |
{ | |
"type": "text", | |
"name": "filename", | |
"prompt": "i18n('filename')", | |
"placeHolder": "i18n('filename')", | |
"suggest": { | |
"selected": true, | |
"value": "main" | |
} | |
} | |
], | |
"items": { | |
"$ref": "#/definitions/Input" | |
} | |
}, | |
"comment": { | |
"description": "comment config", | |
"type": "object", | |
"properties": { | |
"dateFormat": { | |
"description": "code comment date format", | |
"type": "string", | |
"default": "YYYY-MM-DD" | |
}, | |
"copyright": { | |
"description": "copyright string", | |
"default": "Copyright (c) {{year}}, {{user}}. All rights reserved." | |
}, | |
"startLine": { | |
"description": "comment first line string", | |
"type": "string", | |
"default": "/**" | |
}, | |
"lineHeader": { | |
"description": "expect first and last line, comment every line header string", | |
"type": "string", | |
"default": "* " | |
}, | |
"endLine": { | |
"description": "comment last line string", | |
"type": "string", | |
"default" : " */" | |
}, | |
"items": { | |
"type": "array", | |
"default": [ | |
"{{comment.copyright}}", | |
"\n", | |
"@author {{user}}", | |
"@date {{date}}", | |
"@version {{version}}" | |
], | |
"items": { | |
"type": "string" | |
} | |
} | |
} | |
}, | |
"match": { | |
"description": "show when this condition is matched", | |
"type": "object", | |
"properties": { | |
"workspaceFolderGlobs": { | |
"type": "array", | |
"description": "workspace folder glob match", | |
"items": { | |
"type": "string" | |
} | |
}, | |
"always": { | |
"type": "boolean", | |
"description": "Whether it always matches", | |
"default": true | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment