Skip to content

Commit

Permalink
🎉 Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrazeur committed Mar 22, 2020
0 parents commit 7834f52
Show file tree
Hide file tree
Showing 27 changed files with 2,923 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .eslintrc.json
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"
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
out
.vscode
.vscode-test
10 changes: 10 additions & 0 deletions .vscodeignore
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
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
77 changes: 77 additions & 0 deletions README.md
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`. |
84 changes: 84 additions & 0 deletions hyper-shortcut-model-definition.json
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"]
}
1 change: 1 addition & 0 deletions images/dark/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions images/hyper-shortcut-activity-bar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/light/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7834f52

Please sign in to comment.