Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Commit

Permalink
1.0.0 - Initial release
Browse files Browse the repository at this point in the history
Initial release
  • Loading branch information
dacoto97 authored Jul 11, 2018
2 parents 409aea7 + 095d26b commit f4fbc64
Show file tree
Hide file tree
Showing 11 changed files with 2,948 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Set default behavior to automatically normalize line endings.
* text=auto

4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### 1.0.0
Initial release
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
# laravel-easy-blade-snippets
Laravel blade snippets para Visual Studio Code
# Laravel Easy Blade Snippets

Laravel blade snippets for Visual Studio Code

## Usage
The included snippets are organized in categories following Laravel's Facades and their documentation; such as `Auth::`, `Config::` and `Session::`.

All the snippets in this package follow the following naming convention : `{category}::{function name}`. For example : `Auth::check` will produce this snippet in your code : `Auth::check()`.

## Included snippets
Here are the available snippet categories and prefixes :

Prefix | Notes
----------- | -------------
Auth |
Blade |
Cache |
Config |
Console |
Cookie |
Crypt |
DB | To create raw database queries and transactions.
Event |
Form|
Hash |
Helper | Contains sub-categories : `Helper::array`, `Helper::misc`, `Helper::path`, `Helper::strings`, and `Helper::url`; just like in [Laravel's documentation](http://laravel.com/docs/5.1/helpers#available-methods).
Input |
Log |
Mail |
Redirect |
Relation | To create model relationships.
Response |
Route |
Schema | Contains two sub-categories : `Schema::` for snippets related to the database table itself; and `Column::` for snippets related to the columns.
Session |
Storage |
View |
Validator |

**Enjoy!**
28 changes: 28 additions & 0 deletions config/blade.configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"comments": {
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "{{-- ", " --}}" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
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.
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "laravel-easy-blade-snippets",
"displayName": "Laravel Easy Blade Snippets",
"description": "Laravel blade snippets",
"icon": "images/icon.png",
"version": "1.0.0",
"publisher": "dacoto",
"engines": {
"vscode": "^1.25.0"
},
"categories": [
"Snippets"
],
"contributes": {
"languages": [
{
"id": "blade",
"aliases": [
"Laravel Blade",
"Blade",
"blade"
],
"extensions": [
".blade.php"
],
"configuration": "./config/blade.configuration.json"
}
],
"snippets": [
{
"language": "php",
"path": "./snippets/snippets.json"
},
{
"language": "blade",
"path": "./snippets/blade.json"
},
{
"language": "blade",
"path": "./snippets/helpers.json"
},
{
"language": "php",
"path": "./snippets/objects.json"
}
]
}
}
114 changes: 114 additions & 0 deletions snippets/blade.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"b:can": {
"prefix": "Blade::can",
"body": [
"\n@can('${1:ability}', ${2:$$object})\n ${3}\n@else\n\t${4}\n@endcan\n"
],
"description": "Blade @can"
},
"b:cannot": {
"prefix": "Blade::cannot",
"body": "\n@cannot('${1:ability}', ${2:$$object})\n ${3}\n@endcannot\n",
"description": "Blade @cannot"
},
"b:choice": {
"prefix": "Blade::choice",
"body": "\n@choice('${1:file.message}', ${2:$$count})\n",
"description": "Blade @choice"
},
"b:comment": {
"prefix": "Blade::comment",
"body": "\n{{-- ${1:some hidden comment} --}}\n",
"description": "Blade comments"
},
"b:each": {
"prefix": "Blade::each",
"body": "\n@each('${1:view.name}', ${2:$$collection}, ${3:'variable name'}, ${4:'view.empty'})\n",
"description": "Blade @each"
},
"b:elseif": {
"prefix": "Blade::elseif",
"body": "\n@elseif (${1:$$condition})\n",
"description": "Blade @elseif"
},
"b:escape": {
"prefix": "Blade::escape",
"body": "\n@{{ ${1:This will not be processed by Blade} }}\n",
"description": "Blade escape curly braces"
},
"b:extends": {
"prefix": "Blade::extends",
"body": "\n@extends('${1:layouts.name}')\n",
"description": "Blade @extends"
},
"b:for": {
"prefix": "Blade::for",
"body": "\n@for (${1:$$i} = ${2:0}; ${1:$$i} < ${3:10}; ${1:$$i}++)\n\t${4}\n@endfor\n",
"description": "Blade @for"
},
"b:foreach": {
"prefix": "Blade::foreach",
"body": "\n@foreach (${1:$$records} as ${2:$$record})\n\t${3}\n@endforeach\n",
"description": "Blade @foreach"
},
"b:forelse": {
"prefix": "Blade::forelse",
"body": "\n@foreach (${1:$$records} as ${2:$$record})\n\t${3}\n@forelse\n\t${4}\n@endforelse\n",
"description": "Blade @forelse"
},
"b:if": {
"prefix": "Blade::if",
"body": "\n@if (${1:$$condition})\n\t${2}\n@endif\n",
"description": "Blade @if"
},
"b:ifelse": {
"prefix": "Blade::ifelse",
"body": "\n@if (${1:$$condition})\n\t${2}\n@else\n\t${3}\n@endif\n",
"description": "Blade @ifelse"
},
"b:include": {
"prefix": "Blade::include",
"body": "\n@include('${1:view.name}', ${1:$$data})\n",
"description": "Blade @include"
},
"b:lang": {
"prefix": "Blade::lang",
"body": "\n@lang('${1:file.message}')\n",
"description": "Blade @lang"
},
"b:push": {
"prefix": "Blade::push",
"body": "\n@push('${1:stack name}')\n\t${2}\n@endpush\n",
"description": "Blade @push"
},
"b:section": {
"prefix": "Blade::section",
"body": "\n@section('${1:content}')\n\t${2}\n@stop\n",
"description": "Blade @section"
},
"b:stack": {
"prefix": "Blade::stack",
"body": "\n@stack('${1:stack name}')\n",
"description": "Blade @stack"
},
"b:unescaped": {
"prefix": "Blade::unescaped",
"body": "\n{!! ${1:some unescaped value} !!}\n",
"description": "Blade {!! echo raw data !!}"
},
"b:unless": {
"prefix": "Blade::unless",
"body": "\n@unless (${1:$$condition})\n\t${2}\n@endunless\n",
"description": "Blade @unless"
},
"b:while": {
"prefix": "Blade::while",
"body": "\n@while (${1:$$condition})\n\t${2}\n@endwhile\n",
"description": "Blade @while"
},
"b:yield": {
"prefix": "Blade::yield",
"body": "\n@yield('${1:content}')\n",
"description": "Blade @yield"
}
}
137 changes: 137 additions & 0 deletions snippets/helpers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"Form::checkbox": {
"prefix": "Form::checkbox",
"body": "\n{!! Form::checkbox(${1:$$name}, ${2:$$value}, ${3:$$checked}, [${4:$$options}]) !!}\n",
"description": "Create a checkbox input field."
},
"Form::close": {
"prefix": "Form::close",
"body": "\n{!! Form::close(${1}) !!}\n",
"description": "Closes a form tag"
},
"Form::date": {
"prefix": "Form::date",
"body": "\n{!! Form::date(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a date input field"
},
"Form::datetime": {
"prefix": "Form::datetime",
"body": "\n{!! Form::datetime(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a datetime input field"
},
"Form::datetimeLocal": {
"prefix": "Form::datetimeLocal",
"body": "\n{!! Form::datetimeLocal(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a datetime-local input field"
},
"Form::email": {
"prefix": "Form::email",
"body": "\n{!! Form::email(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create an e-mail input field"
},
"Form::file": {
"prefix": "Form::file",
"body": "\n{!! Form::file(${1:$$name}, [${2:$$options}]) !!}\n",
"description": "Create a file input field"
},
"Form::hidden": {
"prefix": "Form::hidden",
"body": "\n{!! Form::hidden(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a hidden input field"
},
"Form::label": {
"prefix": "Form::label",
"body": "\n{!! Form::label(${1:$$for}, ${2:$$text}, [${3:$$options}]) !!}\n",
"description": "Create a form label element."
},
"Form::model": {
"prefix": "Form::model",
"body": "\n{!! Form::model(${1:$$user}, [${2:$$options}]) !!}\n",
"description": "Create a new model based form builder."
},
"Form::number": {
"prefix": "Form::number",
"body": "\n{!! Form::number(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a number input field"
},
"Form::open": {
"prefix": "Form::open",
"body": "\n{!! Form::open(${1}) !!}\n",
"description": "Open up a new HTML form"
},
"Form::password": {
"prefix": "Form::password",
"body": "\n{!! Form::password(${1:$$name}, [${2:$$options}]) !!}\n",
"description": "Create a password input field"
},
"Form::radio": {
"prefix": "Form::radio",
"body": "\n{!! Form::radio(${1:$$name}, ${2:$$value}, ${3:$$checked}, [${4:$$options}]) !!}\n",
"description": "Create a radio button input field"
},
"Form::select": {
"prefix": "Form::select",
"body": "\n{!! Form::select(${1:$$name}, ${2:$$list}, ${3:$$selected}, [${4:$$options}]) !!}\n",
"description": "Create a select box field"
},
"Form::selectMonth": {
"prefix": "Form::selectMonth",
"body": "\n{!! Form::selectMonth(${1:$$name}, ${2:$$selected}, [${3:$$options}]) !!}\n",
"description": "Create a select month field"
},
"Form::selectRange": {
"prefix": "Form::selectRange",
"body": "\n{!! Form::selectRange(${1:$$name}, ${2:$$min}, ${3:$$max}), ${4:$$selected}, [${5:$$options} !!}\n",
"description": "Create a select range field"
},
"Form::submit": {
"prefix": "Form::submit",
"body": "\n{!! Form::submit(${1:$$text}, [${2:$$options}]) !!}\n",
"description": "Create a submit button element"
},
"Form::text": {
"prefix": "Form::text",
"body": "\n{!! Form::text(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a text input field"
},
"Form::textarea": {
"prefix": "Form::textarea",
"body": "\n{!! Form::textarea(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a textarea input field"
},
"Form::time": {
"prefix": "Form::time",
"body": "\n{!! Form::time(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a time input field"
},
"Form::token": {
"prefix": "Form::token",
"body": "\n{!! Form::token(${1}) !!}\n",
"description": "Generate a hidden field with the current CSRF token"
},
"Form::url": {
"prefix": "Form::url",
"body": "\n{!! Form::url(${1:$$name}, ${2:$$value}, [${3:$$options}]) !!}\n",
"description": "Create a url input field"
},
"link_to": {
"prefix": "link_to",
"body": "\n{!! link_to(${1:$url}, ${2:$title = null}, ${3:$attributes = []}, ${4:$secure = null}, ${5:$escape = true}) !!}\n",
"description": "Generate a HTML link"
},
"link_to_asset": {
"prefix": "link_to_asset",
"body": "\n{!! link_to_asset(${1:$url}, ${2:$title = null}, ${3:$attributes = []}, ${4:$secure = null}) !!}\n",
"description": "Generate a HTML link to an asset"
},
"link_to_route": {
"prefix": "link_to_route",
"body": "\n{!! link_to_route(${1:$name}, ${2:$title = null}, ${3:$parameters = []}, ${4:$attributes = []}) !!}\n",
"description": "Generate a HTML link to a named route"
},
"link_to_action": {
"prefix": "link_to_action",
"body": "\n{!! link_to_action(${1:$action}, ${2:$title = null}, ${3:$parameters = []}, ${4:$attributes = []}) !!}\n",
"description": "Generate a HTML link to a controller action"
}
}
Loading

0 comments on commit f4fbc64

Please sign in to comment.