-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7834f52
Showing
27 changed files
with
2,923 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/class-name-casing": "warn", | ||
"@typescript-eslint/semi": "warn", | ||
"curly": "warn", | ||
"eqeqeq": "warn", | ||
"no-throw-literal": "warn", | ||
"semi": "off" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
out | ||
.vscode | ||
.vscode-test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
out/test/** | ||
src/** | ||
.gitignore | ||
vsc-extension-quickstart.md | ||
**/tsconfig.json | ||
**/.eslintrc.json | ||
**/*.map | ||
**/*.ts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Change Log | ||
|
||
All notable changes to the "hyper-shortcut" extension will be documented in this file. | ||
|
||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. | ||
|
||
## [0.0.1] | ||
|
||
- Initial release |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/johnrazeur/hyper-shortcut/master/images/header.png" width=1000/> | ||
</p> | ||
|
||
# Hyper-shortcut | ||
|
||
## Example | ||
|
||
Create at the root folder of your workpace a folder named `templates`. | ||
Define a shortcut template, for example create a `createController.tpl` file: | ||
|
||
```php | ||
<?php | ||
|
||
class {{name}}Controller | ||
{ | ||
// {{testInput}} | ||
} | ||
``` | ||
|
||
Template file are interpreted using [Mustache](https://github.com/janl/mustache.js/), so you have access to all of the mustache syntax. | ||
|
||
Create a file named `hyper-shortcut.json` at the root folder of your namespace with the following data: | ||
|
||
```json | ||
{ | ||
"templatesPath": "templates", | ||
"shortcuts": [{ | ||
"group": "Create", | ||
"name": "Controller (API)", | ||
"type": "create", | ||
"path": "{{name}}.php", | ||
"template": "createApiController", | ||
"actions": { | ||
"type": "input", | ||
"name": "testInput", | ||
"prompt": "Test of the input" | ||
}, | ||
} | ||
} | ||
``` | ||
|
||
When type is `create`, Hyper-Shorcut will prompt an input box asking the name of the file to the user. The name file is store in the variable `name` and you can use it in the template and in the `path` attribute of `hyper-shortcut.json`. | ||
|
||
Actions is a list of variables the user must specifies. Result is store in the `name` variable, you can use it in the template file. | ||
Type must be `input`or `quickPick`. If type is `quickPick`, you must provide an `items` ( array of string ) of the possible values of the action. | ||
|
||
|
||
## Configuration | ||
|
||
You must create a file named `hyper-shortcut.json` at the root of your workspace. | ||
|
||
| Name | Type | Description | | ||
|--- |--- |--- | | ||
| templatesPath | string | Where template files are stored. | | ||
| shortcuts | Shortcut[] | List of shortcuts. | | ||
|
||
### Shortcut | ||
|
||
| Name | Type | Description | | ||
|--- |--- |--- | | ||
| group | string | Group name of the shortcut. The view group shortcuts by their groups name. | | ||
| name | string | Name of the shortcut. | | ||
| type | string | Type of insertion. Must be `create` or `insert`. | | ||
| path | string | Path where the file is created when type is `create`. | | ||
| template | string | Template file of the shortcut in the `̀templatesPath` folder. | | ||
| info | string | Template file of the info. Info are displayed in readonly beside active editor. | | ||
| actions | Action[] | List of actions. Action ask user the value of a variable. | | ||
|
||
### Action | ||
|
||
| Name | Type | Description | | ||
|--- |--- |--- | | ||
| type | string | Type of the action. Muse be `input` or `quickPick`. | | ||
| name | string | Name of the variable. | | ||
| prompt | string | Text displayed in the input box. | | ||
| items | string[] | List of choice if `type` is `quickPick`. | |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"$schema" : "http://json-schema.org/draft-07/schema#", | ||
"id": "https://raw.githubusercontent.com/johnrazeur/hyper-shortcut/master/dist/hyper-shortcut-model-definition.json", | ||
"title": "Hyper-Shortcut Model Definition", | ||
"description": "Hyper-Shortcut configuration file", | ||
"properties": { | ||
"templatesPath" : { | ||
"type" : "string", | ||
"description": "Template path.\rWhere template files are stored." | ||
}, | ||
"shortcuts": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"group": { | ||
"type": "string" | ||
}, | ||
"name": { | ||
"type": "string" | ||
}, | ||
"type": { | ||
"type": "string", | ||
"enum": ["create", "insert"] | ||
}, | ||
"path": { | ||
"type": "string" | ||
}, | ||
"template": { | ||
"type": "string" | ||
}, | ||
"info": { | ||
"type": "string" | ||
}, | ||
"actions": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["input", "quickPick"] | ||
}, | ||
"name": { | ||
"type": "string" | ||
}, | ||
"prompt": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["type", "name", "prompt"], | ||
"defaultSnippets": [ | ||
{ | ||
"label": "New action", | ||
"body": { | ||
"type": "$1", | ||
"name": "$2", | ||
"prompt": "$3" | ||
} | ||
} | ||
], | ||
"if": { | ||
"properties": { "type": { "const": "quickPick" } } | ||
}, | ||
"then": { | ||
"properties": { | ||
"items": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": ["items"] | ||
} | ||
} | ||
} | ||
}, | ||
"required": ["template", "group", "name", "type"] | ||
} | ||
} | ||
}, | ||
"required": ["templatesPath"] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.