update cmd line

This commit is contained in:
asep komarudin 2023-03-03 07:09:50 +07:00
parent 67a507d530
commit 8c55f6b749
214 changed files with 48553 additions and 48489 deletions

View file

@ -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"
}
}

3
snippets/laravel-blade2/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
dist
node_modules
*.vsix

View file

@ -0,0 +1,18 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}

View file

@ -0,0 +1,4 @@
.vscode
.gitignore
.eslintrc.json
tsconfig.json

View file

@ -0,0 +1,13 @@
# Change Log
All notable changes to the "Laravel Blade" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [v2.0.4]
- Add switch statements
## [Released]
- Initial release

View file

@ -0,0 +1,19 @@
Copyright 2020 Amir Marmul
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,60 @@
# Laravel Blade
[![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/amirmarmul.laravel-blade-vscode?label=vscode%20downloads)](https://marketplace.visualstudio.com/items?itemName=amirmarmul.laravel-blade-vscode)
[![Open VSX Downloads](https://img.shields.io/open-vsx/dt/amirmarmul/laravel-blade-vscode?label=open-vsx%20downloads)](https://open-vsx.org/extension/amirmarmul/laravel-blade-vscode)
Laravel Blade Snippets, Syntax Highlighting and Formatting for VS Code.
Converted from [language-blade](https://github.com/jawee/language-blade).
## User Setting
Enable html emmet:
>```json
>"emmet.includeLanguages": {
> "blade": "html"
>},
>```
## Features
- Syntax highlighter
- Blade snippets
- Blade formatting
## Screenshoot
![Screenshoot](images/screenshot.png)
## Known Issues
Calling out known issues can help limit users opening duplicate issues against your extension.
## Release Notes
Users appreciate release notes as you update your extension.
### 2.0.2
- Add support to vscode 1.37
### 2.0.1
- Update README.md file
### 2.0.0
- Added blade formatting
- Change codebase to newest vscode extension template
### 1.0.3
- Added some new directive based on Laravel 6.x
### 1.0.2
- Update README.md
- Compatible with vscode 1.39 and above
### 1.0.0
Initial release

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

4769
snippets/laravel-blade2/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,105 @@
{
"name": "laravel-blade-vscode",
"displayName": "Laravel Blade",
"description": "Snippets, Syntax Highlighting and Formatting for VS Code",
"publisher": "amirmarmul",
"version": "2.0.4",
"author": {
"name": "Amir Marmul",
"email": "amiruddinmarmul@gmail.com"
},
"homepage": "https://github.com/amirmarmul/laravel-blade-vscode",
"repository": {
"type": "git",
"url": "https://github.com/amirmarmul/laravel-blade-vscode"
},
"bugs": {
"url": "https://github.com/amirmarmul/laravel-blade-vscode/issues"
},
"icon": "images/icon.png",
"engines": {
"vscode": "^1.37.0"
},
"categories": [
"Programming Languages",
"Snippets"
],
"keywords": [
"laravel",
"blade",
"snippet",
"highlighter",
"beautify"
],
"activationEvents": [
"onLanguage:blade"
],
"main": "./dist/extension.js",
"contributes": {
"languages": [
{
"id": "blade",
"aliases": [
"Blade",
"blade"
],
"extensions": [
".blade.php"
],
"configuration": "./src/languages/blade.configuration.json"
}
],
"grammars": [
{
"language": "php",
"scopeName": "text.html.php.blade",
"path": "./src/syntaxes/blade.tmLanguage.json"
}
],
"snippets": [
{
"language": "php",
"path": "./src/snippets/snippets.json"
}
],
"configuration": {
"type": "object",
"title": "Blade Language",
"properties": {
"blade.format.enable": {
"type": "boolean",
"default": true,
"description": "Whether to enable/disable formatting."
},
"blade.newLine": {
"type": "boolean",
"default": true,
"description": "Insert an empty line at the end of file."
}
}
}
},
"scripts": {
"vscode:prepublish": "yarn run compile",
"compile": "tsc -p ./",
"lint": "eslint src --ext ts",
"watch": "tsc -watch -p ./"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/mocha": "^7.0.1",
"@types/node": "^12.11.7",
"@types/vscode": "^1.37.0",
"@typescript-eslint/eslint-plugin": "^2.18.0",
"@typescript-eslint/parser": "^2.18.0",
"eslint": "^6.8.0",
"glob": "^7.1.6",
"mocha": "^7.0.1",
"typescript": "^3.7.5",
"vscode-test": "^1.3.0"
},
"dependencies": {
"js-beautify": "^1.10.3"
},
"license": "MIT"
}

View file

@ -0,0 +1,178 @@
import * as vscode from 'vscode';
const Beautifier = require('js-beautify').html;
// function bladeBeautifier(html_source: any, options: any) {
// //Wrapper function to invoke all the necessary constructors and deal with the output.
// html_source = html_source || '';
// // BEGIN
// html_source = html_source.replace(/\{\{((?:(?!\}\}).)+)\}\}/g, function (m: any, c: any) {
// if (c) {
// c = c.replace(/(^[ \t]*|[ \t]*$)/g, '');
// c = c.replace(/'/g, ''');
// c = c.replace(/"/g, '"');
// c = encodeURIComponent(c);
// }
// return "{{" + c + "}}";
// });
// html_source = html_source.replace(/^[ \t]*@([a-z]+)([^\r\n]*)$/gim, function (m: any, d: any, c: any) {
// var ce = c;
// if (ce) {
// ce = ce.replace(/'/g, ''');
// ce = ce.replace(/"/g, '"');
// ce = "|" + encodeURIComponent(ce);
// }
// switch (d) {
// case 'break':
// case 'case':
// case 'continue':
// case 'csrf':
// case 'else':
// case 'elseif':
// case 'empty':
// case 'extends':
// case 'include':
// case 'includeFirst':
// case 'includeIf':
// case 'includeWhen':
// case 'inject':
// case 'json':
// case 'method':
// case 'parent':
// case 'stack':
// case 'yield':
// return "<blade " + d + ce + "/>";
// case 'section':
// if(c.match(/[ \t]*\([ \t]*['"][^'"]*['"][ \t]*\)/i)){
// return "<blade " + d + ce + ">";
// } else {
// return "<blade " + d + ce + "/>";
// }
// case 'show':
// case 'stop':
// return "</blade " + d + ce + ">";
// default:
// if (d.startsWith('end')) {
// return "</blade " + d + ce + ">";
// } else {
// return "<blade " + d + ce + ">";
// }
// }
// });
// // END
// var sweet_code = Beautifier(html_source, options);
// // BEGIN
// sweet_code = sweet_code.replace(/^([ \t]*)<\/?blade ([a-z]+)\|?([^>\/]+)?\/?>$/gim, function (m: any, s: any, d: any, c: any) {
// if (c) {
// c = decodeURIComponent(c);
// c = c.replace(/&#39;/g, "'");
// c = c.replace(/&#34;/g, '"');
// c = c.replace(/^[ \t]*/g, '');
// } else {
// c = "";
// }
// if (!s) {
// s = "";
// }
// return s + "@" + d + c;
// });
// sweet_code = sweet_code.replace(/\{\{((?:(?!\}\}).)+)\}\}/g, function (m: any, c: any) {
// if (c) {
// c = decodeURIComponent(c);
// c = c.replace(/&#39;/g, "'");
// c = c.replace(/&#34;/g, '"');
// c = c.replace(/(^[ \t]*|[ \t]*$)/g, ' ');
// }
// return "{{" + c + "}}";
// });
// // END
// return sweet_code;
// }
const editor = vscode.workspace.getConfiguration('editor');
const config = vscode.workspace.getConfiguration('blade');
function beautify(document: vscode.TextDocument, range: vscode.Range) {
const result = [];
let output = '';
let options = Beautifier.defaultOptions;
options.indent_size = editor.tabSize;
options.end_with_newline = config.newLine;
options.indent_char = ' ';
options.extra_liners = [];
options.brace_style = 'collapse';
options.indent_scripts = 'normal';
options.space_before_conditional = true;
options.keep_array_indentation = false;
options.break_chained_methods = false;
options.unescape_strings = false;
options.wrap_line_length = 0;
options.jslint_happy = false;
options.comma_first = true;
options.e4x = true;
output = Beautifier(document.getText(range), options);
result.push(vscode.TextEdit.replace(range, output));
return result;
}
function activate(context: vscode.ExtensionContext) {
console.log('Laravel blade activated!');
const LANGUAGES = { scheme: 'file', language: 'blade' };
if (config.format.enable === true) {
context.subscriptions.push(
vscode.languages.registerDocumentFormattingEditProvider(LANGUAGES, {
provideDocumentFormattingEdits(document: vscode.TextDocument) {
const start = new vscode.Position(0, 0);
const end = new vscode.Position(
document.lineCount - 1,
document.lineAt(document.lineCount -1).text.length
);
const rng = new vscode.Range(start, end);
return beautify(document, rng);
}
})
);
context.subscriptions.push(
vscode.languages.registerDocumentRangeFormattingEditProvider(LANGUAGES, {
provideDocumentRangeFormattingEdits(document: vscode.TextDocument, range: vscode.Range) {
let end = range.end
if (end.character === 0) {
end = end.translate(-1, Number.MAX_VALUE);
} else {
end = end.translate(0, Number.MAX_VALUE);
}
const rng = new vscode.Range(new vscode.Position(range.start.line, 0), end)
return beautify(document, rng);
}
}
)
)
}
}
function deactivate() {}
export {
activate,
deactivate,
}

View file

@ -0,0 +1,24 @@
{
"comments": {
"blockComment": [ "{{--", "--}}" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}

View file

@ -0,0 +1,392 @@
{
"csrf": {
"description": "Includes a CSRF field for use in forms.",
"prefix": "@csrf",
"body": [
"@csrf$0"
]
},
"else": {
"description": "Control structure for use with if statements.",
"prefix": "@else",
"body": [
"@else$0"
]
},
"append": {
"description": "Appends defined section to an existing one of the same name.",
"prefix": "@append",
"body": [
"@append$0"
]
},
"overwrite": {
"description": "Overwrites a defined section.",
"prefix": "@overwrite",
"body": [
"@overwrite$0"
]
},
"show": {
"description": "Shows and yields immediately a defined section.",
"prefix": "@show",
"body": [
"@show$0"
]
},
"endsection": {
"description": "Close a defined section.",
"prefix": "@endsection",
"body": [
"@endsection$0"
]
},
"stop": {
"description": "Alternative syntax for @endsection.",
"prefix": "@stop",
"body": [
"@stop$0"
]
},
"parent": {
"description": "Appends content a section instead of overwriting.",
"prefix": "@parent",
"body": [
"@parent$0"
]
},
"elseif": {
"description": "Elseif branch used in if statements.",
"prefix": "@elseif",
"body": [
"@elseif(${1:$${2:condition}})$0"
]
},
"foreach": {
"description": "Executes a foreach loop statement.",
"prefix": "@foreach",
"body": [
"@foreach($${1:variable} as $${2:${3:key} => $${4:value}})",
"\t$0",
"@endforeach"
]
},
"if": {
"description": "If statement.",
"prefix": "@if",
"body": [
"@if(${1:$${2:condition}})",
"\t$0",
"@endif"
]
},
"if-else": {
"description": "If-else statement.",
"prefix": "@if",
"body": [
"@if(${1:$${2:condition}})",
"\t$3",
"@else",
"\t$0",
"@endif"
]
},
"extends": {
"description": "Extends a layout.",
"prefix": "@extends",
"body": [
"@extends('${1:view}')$0"
]
},
"for": {
"description": "For loop.",
"prefix": "@for",
"body": [
"@for($${1:i} = ${2:0}; $${1:i} < ${3:10}; $${1:i}++)",
"\t$0",
"@endfor"
]
},
"forelse": {
"description": "Executes a foreach loop or displays contents of @empty block if there are no entries.",
"prefix": "@forelse",
"body": [
"@forelse($${1:variable} as $${2:${3:key} => $${4:value}})",
"\t$5",
"@empty",
"\t$0",
"@endforelse"
]
},
"lang": {
"description": "Displays a localized string.",
"prefix": "@lang",
"body": [
"@lang('${1:category.line}')$0"
]
},
"prepend": {
"description": "Prepends content to stack.",
"prefix": "@prepend",
"body": [
"@prepend('${1:name}')",
"\t$0",
"@endprepend"
]
},
"push": {
"description": "Pushes content to stack.",
"prefix": "@push",
"body": [
"@push('${1:name}')",
"\t$0",
"@endpush"
]
},
"section": {
"description": "Defines a section of content.",
"prefix": "@section",
"body": [
"@section('${1:name}'${2:, '${3:content}'})$0"
]
},
"section-end": {
"description": "Defines a section-end of content.",
"prefix": "@section",
"body": [
"@section('${1:name}')",
"\t$0",
"@endsection"
]
},
"stack": {
"description": "Renders contents of the stack.",
"prefix": "@stack",
"body": [
"@stack('${1:name}')$0"
]
},
"unless": {
"description": "Shorthand for if-not statement.",
"prefix": "@unless",
"body": [
"@unless(${1:$${2:condition}})",
"\t$0",
"@endunless"
]
},
"while": {
"description": "While loop.",
"prefix": "@while",
"body": [
"@while(${1:$${2:condition}})",
"\t$0",
"@endwhile"
]
},
"yield": {
"description": "Displays contents of a given section.",
"prefix": "@yield",
"body": [
"@yield('${1:section}')$0"
]
},
"php": {
"description": "Embeds PHP code.",
"prefix": "@php",
"body": [
"@php",
"\t$0",
"@endphp"
]
},
"component": {
"description": "Constructs a component.",
"prefix": "@component",
"body": [
"@component('${1:component}')",
"\t$0",
"@endcomponent"
]
},
"componentFirst": {
"description": "Instruct to load the first view that exists from a given array of possible views for the component.",
"prefix": "@component",
"body": [
"@componentFirst(['${1:custom.component}', '${2:component}'])",
"\t$0",
"@endcomponent"
]
},
"slot": {
"description": "Injects content into slot variable.",
"prefix": "@slot",
"body": [
"@slot('${1:variable}')",
"\t$0",
"@endslot"
]
},
"isset": {
"description": "Determines whether a variable is considered to be empty using PHP isset() function.",
"prefix": "@isset",
"body": [
"@isset(${1:$${2:var}})",
"\t$0",
"@endisset"
]
},
"verbatim": {
"description": "Protects text from being processed as Blade syntax.",
"prefix": "@verbatim",
"body": [
"@verbatim",
"\t$0",
"@endverbatim"
]
},
"empty": {
"description": "Determines whether a variable is considered to be empty using PHP empty() function.",
"prefix": "@empty",
"body": [
"@empty(${1:$${2:var}})",
"\t$0",
"@endempty"
]
},
"continue": {
"description": "Continue statement used in loops.",
"prefix": "@continue",
"body": [
"@continue${1:(${2:$${3:condition}})}$0"
]
},
"break": {
"description": "Break statement used in switches and loops.",
"prefix": "@break",
"body": [
"@break${1:(${2:$${3:condition}})}$0"
]
},
"include": {
"description": "Includes a sub-view.",
"prefix": "@include",
"body": [
"@include('${1:view}')$0"
]
},
"includeIf": {
"description": "Includes a view if present.",
"prefix": "@include",
"body": [
"@includeIf('${1:view}'${2:, ['${3:some}' => '${4:data}']})$0"
]
},
"includeWhen": {
"description": "Includes a view if a given boolean expression evaluates to true.",
"prefix": "@include",
"body": [
"@includeWhen(${1:boolean}, '${2:view}'${3:, ['${4:some}' => '${5:data}']})$0"
]
},
"includeUnless": {
"description": "Includes a view if a given boolean expression evaluates to false.",
"prefix": "@include",
"body": [
"@includeUnless(${1:boolean}, '${2:view}'${3:, ['${4:some}' => '${5:data}']})$0"
]
},
"includeFirst": {
"description": "Includes a view the first view that exists from a given array of views.",
"prefix": "@include",
"body": [
"@includeFirst(['${1:custom.view}', '${2:view}']${3:, ['${4:some}' => '${5:data}']})$0"
]
},
"inject": {
"description": "Retrieves a service from the Laravel service container.",
"prefix": "@inject",
"body": [
"@inject('${1:var}', ${2:${3:SomeClass}::class})$0"
]
},
"can": {
"description": "Determines whether user has been authorized to perform an action.",
"prefix": "@can",
"body": [
"@can('${1:update}', $${2:user})",
"\t$0",
"@endcan"
]
},
"cannot": {
"description": "Determines whether user has not been authorized to perform an action.",
"prefix": "@cannot",
"body": [
"@cannot('${1:update}', $${2:user})",
"\t$0",
"@endcannot"
]
},
"auth": {
"description": "Determines whether user has authenticated.",
"prefix": "@auth",
"body": [
"@auth${1:('${2:admin}')}",
"\t$0",
"@endauth"
]
},
"guest": {
"description": "Determines whether user is guest.",
"prefix": "@guest",
"body": [
"@guest",
"\t$0",
"@endguest"
]
},
"error": {
"description": "Determines whether there is an input error associated with the field.",
"prefix": "@error",
"body": [
"@error('${1:field}')",
"\t$0",
"@enderror"
]
},
"method": {
"description": "Defines a hidden _method field to spoof HTTP verbs.",
"prefix": "@method",
"body": [
"@method('${1:put}')$0"
]
},
"each": {
"description": "Defines a rendering views for collections.\n\n- The first argument is the view partial to render for each element in the array or collection.\n- The second argument is the array or collection you wish to iterate over\n- Third argument is the variable name that will be assigned to the current iteration within the view.\n- This fourth argument is the view that will be rendered if the given array is empty.",
"prefix": "@each",
"body": [
"@each('${1:view.name}', $${2:jobs}, '${3:job}', '${4:view.empty}')$0"
]
},
"json": {
"description": "Defines a rendering an array to JSON.\n\nThis directive accepts the same arguments as PHP's json_encode function.",
"prefix": "@json",
"body": [
"@json($${1:array})$0"
]
},
"switch": {
"description": "Switch Statements.",
"prefix": "@switch",
"body": [
"@switch($${0:value})",
"\t@case(${1:value})",
"\t\t${2}",
"\t\t@break",
"\t$@default",
"\t\t${3}",
"@endswitch"
]
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "dist",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src",
"strict": true
},
"exclude": [
"node_modules",
".vscode-test"
]
}

File diff suppressed because it is too large Load diff