Skip to content

Commit 074276c

Browse files
committed
Merge branch 'dev-master': some control snippets refactor
2 parents 7262f8b + 27edd97 commit 074276c

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.vscode-test/**
33
.gitignore
44
vsc-extension-quickstart.md
5+
*.php

README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
![Snippets](https://img.shields.io/badge/Type-Snippets-yellow.svg)
55
![PHP7](https://img.shields.io/badge/PHP-%5E7.0-blue.svg)
66
![PHP5](https://img.shields.io/badge/PHP-%5E5.4-blue.svg)
7+
[![SemVer](https://img.shields.io/badge/SemVer-1.1.3-%23B71C1C.svg)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md)
8+
[![MIT](https://img.shields.io/badge/License-MIT-%2300C853.svg)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/LICENSE)
9+
710
[![PSR-1](https://img.shields.io/badge/Standard-PSR--1-%2326A69A.svg)](https://www.php-fig.org/psr/psr-1/)
811
[![PSR-2](https://img.shields.io/badge/Standard-PSR--2-%2326A69A.svg)](https://www.php-fig.org/psr/psr-2/)
912
[![PSR-12](https://img.shields.io/badge/Standard-PSR--12-%2326A69A.svg)](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md)
10-
[![MIT](https://img.shields.io/badge/License-MIT-%2300C853.svg)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/LICENSE)
1113

12-
[![SemVer](https://img.shields.io/badge/SemVer-1.1.2-%23B71C1C.svg)](https://github.com/h4kst3r/php-awesome-snippets/blob/master/CHANGELOG.md)
13-
14-
This [VScode extension](https://marketplace.visualstudio.com/items?itemName=hakcorp.php-awesome-snippets) provide a fullset of snippets for PHP devs. It's pretty simple !
14+
**This [VScode extension](https://marketplace.visualstudio.com/items?itemName=hakcorp.php-awesome-snippets) provide a fullset of snippets for PHP devs. It's pretty simple !**
1515

1616
You can use it to avoid wasting time typing Class blocks, function signatures or other common PHP statements.
1717

1818
![Demo PHP Awesome Snippets](img/snipdemo.gif)
1919

20-
The code generated is as compliant as possible with [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/) and [PSR-12](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md) (*Review* stage) coding standard provided by [PHP-FIG](https://www.php-fig.org/).
20+
The code generated is **as compliant as possible** with [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/) and [PSR-12](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md) (*Review* stage) coding standards provided by [PHP-FIG](https://www.php-fig.org/).
2121

2222
Snippets are PHP7 oriented (type hinting and return type) but PHP5 compatibility is also provided (see [Functions](#function-snip) and [Methods](#method-snip) sections).
2323

@@ -28,7 +28,7 @@ Type a snippet (or part of it), press `Enter` or `Tab` (if `editor.tabCompletion
2828

2929
> ***Tip :*** Snippets provided in this extension support `tab` to next/previous placeholder.
3030
31-
These snippets are meant to work in *PHP* context (VScode file). However there are also available in *Plain Text* files for convenience and PHP tags are available in *HTML* ones.
31+
These snippets are meant to work in **PHP context** (VScode file). However there are also available in **Plain Text context** for convenience and PHP tags are available in **HTML** one.
3232

3333
## Features
3434

@@ -73,7 +73,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
7373
| kv | `'key' => value,` **[1]** |
7474
| va | `value, ` **[1]** |
7575

76-
* **[1]** Addon snippet: use with `arr` or `ark` snippet to add `value` or `key => value` if needed.
76+
* **[1]** Addon snippet : use with `arr` or `ark` snippet to add `value` or `key => value` if needed.
7777

7878
----
7979
### Statements and common functions calls
@@ -99,7 +99,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
9999
| fna | `function (Type $args): void {...}` |
100100
| fnu | `function (Type $args) use ($vars): void {...}` |
101101

102-
***Tip :*** You can call `functions` snippets above without type hinting and return type (**PHP5 compatible**) by using **`-`** as prefix.
102+
***Tip :*** You can call `functions` snippets above without type hinting and return type (**PHP5 compatibility**) by using **`-`** as prefix.
103103
> * `-fna` for `function ($args) {...}` *(anonymous function block)*
104104
105105
----
@@ -114,15 +114,15 @@ Placeholders are quite *'easy to use'* though some need optimizations.
114114
| cs | `case 'label': ... break;` **[1]** |
115115
| tern | `condition ? if_true : if_false;` |
116116

117-
* **[1]** Addon snippet: use with `sw` snippet to add `case` if needed.
117+
* **[1]** Addon snippet : use with `sw` snippet to add `case` if needed.
118118

119-
***Tip :*** The others `if` `else` forms are also available if needed:
119+
***Tip :*** Other `if ... else` form is also available if needed:
120120

121121
> | Snippet | Output |
122122
> | --- | --- |
123-
> | ifend | `if (condition): ... endif;` |
124-
> | ifelend | `if (condition): ... else: ... endif;` |
125-
> | ifelifend | `if (condition): ... elseif (condition): ... else: ... endif;` |
123+
> | ifen | `if (condition): ... endif;` |
124+
> | ifelen | `if (condition): ... else: ... endif;` |
125+
> | ifelifen | `if (condition): ... elseif (condition): ... else: ... endif;` |
126126
127127
----
128128
### Loops structures
@@ -135,7 +135,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
135135
| wl | `while ($variable <= $limit) {...}` |
136136
| dowl | `do {...} while ($variable <= $limit);` |
137137

138-
***Tip :*** The others loop forms are also available if needed:
138+
***Tip :*** Other loops form is also available if needed:
139139

140140
> | Snippet | Output |
141141
> | --- | --- |
@@ -191,7 +191,7 @@ Placeholders are quite *'easy to use'* though some need optimizations.
191191
> * `fpubsf` for `final public static function methodName(Type $args): void {...}`
192192
193193
***Tip :*** You can call `methods` snippets above without type hinting
194-
and return type (**PHP5 compatible**) by using **`-`** as prefix.
194+
and return type (**PHP5 compatibility**) by using **`-`** as prefix.
195195
> * `-apubf` for `abstract public function methodName(parameters) {...}`
196196
197197
----
@@ -205,14 +205,14 @@ and return type (**PHP5 compatible**) by using **`-`** as prefix.
205205
| fy | `finally {...}` **[2]** |
206206
| thr | `throw new SomeException("Error statement");` |
207207

208-
* **[1]** Addon snippet: use with `tryc` or `tryf` snippet to add `catch` if needed.
209-
* **[2]** Addon snippet: use with `tryc` snippet to add `finally` if needed.
208+
* **[1]** Addon snippet : use with `tryc` or `tryf` snippet to add `catch` if needed.
209+
* **[2]** Addon snippet : use with `tryc` snippet to add `finally` if needed.
210210

211211
## Requirements
212212

213213
All you need is VScode installed on your machine.
214214

215-
* Install the extension from extension menu.
215+
* Install the extension from `Extensions` menu.
216216

217217
* You can also press `F1` then type:
218218

@@ -221,6 +221,7 @@ All you need is VScode installed on your machine.
221221
## <a id="ext-settings"></a>Extension Settings
222222

223223
The VScode default behavior deactivate IntelliSense suggestions when you're filling placeholders. However if you want to use completion and snippets inside placeholders :
224+
224225
* Open your settings.json file ( **{ }** icon at the top right corner of the settings tab).
225226

226227
* Add this line anywhere you want: `"editor.suggest.snippetsPreventQuickSuggestions": false`
@@ -229,7 +230,9 @@ Now you can call snippets and any suggestion in placeholders without typing `Ctr
229230

230231
## Known Issues
231232

232-
Sometimes IntelliSense freezes loading or simply don't select the called snippet. Backspace and try again, it should work.
233+
If suggestions menu does not open, press `Ctrl+space` to open it manually.
234+
235+
Sometimes IntelliSense freezes loading or simply doesn't select the called snippet. Backspace and try again, it should work.
233236

234237
## Release Notes
235238

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
"Programming Languages"
1313
],
1414
"keywords": [
15-
"PHP",
16-
"Snippets",
17-
"Productivity",
18-
"PHP Snippets"
15+
"snippets",
16+
"productivity",
17+
"coding",
18+
"php7",
19+
"psr"
1920
],
2021
"icon": "img/php-awesome-icon.png",
2122
"galleryBanner": {

snippets/control.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"If ... endif": {
3-
"prefix": "ifend",
3+
"prefix": "ifen",
44
"body": [
55
"if (${1:condition}):",
66
"\t${0:# code...}",
@@ -9,7 +9,7 @@
99
"description": "If endif block"
1010
},
1111
"If ... else ... endif": {
12-
"prefix": "ifelend",
12+
"prefix": "ifelen",
1313
"body": [
1414
"if (${1:condition}):",
1515
"\t${2:# code...}",
@@ -20,7 +20,7 @@
2020
"description": "If else endif block"
2121
},
2222
"If ... elseif ... else ... endif": {
23-
"prefix": "ifelifend",
23+
"prefix": "ifelifen",
2424
"body": [
2525
"if (${1:condition}):",
2626
"\t${2:# code...}",

0 commit comments

Comments
 (0)