You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+5-137
Original file line number
Diff line number
Diff line change
@@ -9,146 +9,14 @@ After installing as an extension with Visual Studio Code, this extension automat
9
9
* Format current selection only, or the whole file.
10
10
* Trigger formatting with custom keybindings or actions.
11
11
* Supports formatting on save.
12
-
* Supports different PHP-CS-Fixer installation methods, i.e. Composer vs manual installation.
13
12
* Supports level and fixers.
14
13
* Can be configured to support other file extensions than PHP as well, i.e. ".inc" files.
14
+
* Supports different PHP-CS-Fixer installation methods, i.e. Composer vs manual installation.
15
15
16
-
## Requirements
17
-
18
-
Requires installation of the PHP-CS-Fixer. For more info see [their repo](https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation).
19
-
20
-
## Installation Guide
21
-
22
-
1. Download this extension by using any of the methods [here](https://code.visualstudio.com/Docs/extensions/install-extension).
23
-
2. Install PHP-CS-Fixer using one of the methods [here](https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation).
24
-
3. Based on your installation method of PHP-CS-Fixer, use one of the following settings:
25
-
26
-
---
27
-
28
-
### **With Composer**
29
-
30
-
Add Composer to your PATH environment variable. E.g. on Windows: `%APPDATA%\Composer\vendor\bin`. E.g. on Linux: `/.composer/vendor/bin`.
31
-
32
-
Add `"phpformatter.composer": true` to your VSCode user settings.
33
-
34
-

35
-
36
-
---
37
-
38
-
### **Manual**
39
-
40
-
Add PHP to your PATH environment variable. I.e. ensure that `php -v` works. Otherwise use `"phpformatter.phpPath" = "/path/to/php/executable"`.
41
-
42
-
Point the `phpformatter.pharPath` setting to where you put the php-cs-fixer file.
43
-
44
-

45
-
46
-
*Not working?* Make sure the `phpformatter.composer` setting is set to `false`, which it is by default.
47
-
48
-
---
49
-
50
-
4. To format a file with a custom keybinding or action, see [Extension Commands](#commands).
51
-
~~To format a file on save, add this to your [user settings](https://code.visualstudio.com/Docs/customization/userandworkspace): `"phpformatter.onSave" = true`~~ Awaiting VSCode feature to support this functionality.
52
-
5. You're done! You might need to restart Visual Studio Code, however.
53
-
54
-
## Extension Settings
55
-
56
-
This extension contributes the following settings:
57
-
58
-
*`phpformatter.pharPath`: Should point to php-cs-fixer.phar file, if you have installed this manually (without Composer). Should include .phar extension.
59
-
*`phpformatter.phpPath`: If the pharPath is set, and you are not using Composer, this should point to the php.exe file.
60
-
*`phpformatter.composer`: Whether the php-cs-fixer library has been installed using Composer. If true, the extension will override pharPath and assume you have added Composer to your PATH.
61
-
*`phpformatter.onSave`: ~~Whether files should be fixed on save.~~ Not supported right now. Awaiting an [internal VSCode feature](https://github.com/Microsoft/vscode/issues/239). Use [the phpformatter.fix command](#commands) for now instead.
62
-
*`phpformatter.level`: Fixer level to use when fixing a file, e.g. psr0, psr1, psr2, symfony ([More info](https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage)).
63
-
*`phpformatter.fixers`: Fixers to use when fixing a file, e.g. strict, short_array_syntax ([More info](https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage)).
64
-
*`phpformatter.additionalExtensions`: Which additional file extensions, besides PHP, should be fixed as well. E.g. inc, without the leading dot. For this to work you'll also have to configure your VSCode files.associations settings ([More info](https://code.visualstudio.com/Docs/languages/overview#_common-questions)).
65
-
*`phpformatter.logging`: If true, the extension will log all sorts of (debug) info to the console. Useful for troubleshooting.
66
-
*`phpformatter.notifications`: If true, the extension will show notifications.
67
-
68
-
## <aname="commands"></a>Extension commands
69
-
70
-
The extension currently contributes just one command. Your Visual Studio Code environment can be configured to trigger this command with a custom keybinding or other action.
71
-
72
-
### phpformatter.fix
73
-
74
-
* Fixes the current file, or selection, if there is any.
75
-
* Does not save the file after fixing.
76
-
77
-
To set this up. Go to `File -> Preferences -> Keyboard Shortcuts` and add the following to `keybindings.json`:
After saving the file you should be able to format files using the keybinding `alt+shift+f`.
82
-
83
-
## Known Issues
84
-
85
-
* If you add Composer to your PATH, make sure to restart ALL of your Visual Studio Code instances afterwards. Visual Studio Code only reads out PATH variables during startup.
86
-
* If you are on Windows, using xampp, and get the error `PHP Warning: PHP Startup: Unable to load dynamic library`, try going to you xampp directory and run `setup_xampp.bat`. After that, restart Visual Studio Code and try again.
87
-
88
-
**Note:** Most issues stem from incorrect installation of the PHP-CS-Fixer, see [their repo](https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation) for more info.
89
-
90
-
## Release Notes
91
-
92
-
### 0.2.0
93
-
94
-
* Migrated the code to TypeScript!
95
-
* Temp files are now the way to go by default, switching back is no longer supported. Therefore, the `phpformatter.useTempFiles` setting got removed.
96
-
* Deprecated `phpformatter.enableFixerLogging` setting got removed in favor of `phpformatter.logging`.
97
-
* The extension is now categorized as Formatter on the Marketplace.
98
-
99
-
### 0.1.3
100
-
101
-
* Disabled onSave command until VSCode supports preSave event.
102
-
* Improved Readme.
103
-
104
-
### 0.1.2
105
-
106
-
Solved an issue where fixing a file would erase its contents.
107
-
108
-
### 0.1.1
109
-
110
-
New icon.
111
-
112
-
### 0.1.0
113
-
114
-
* Added `phpformatter.useTempFiles` setting, which is on by default. This fixes a whole ranges of issues the old method had, and opens up the road other features as well.
115
-
* Added `phpformatter.fix` command. This introduces the ability to fix a file or selection by registering a custom keybinding. See [Extension Commands](#commands) for more info.
116
-
* Added the ability to fix only the current selection. This requires `phpformatter.useTempFiles` to be turned on.
117
-
* Deprecated `phpformatter.enableFixerLogging` in favor of `phpformatter.logging`.
118
-
* Added `phpformatter.logging` setting to replace `phpformatter.enableFixerLogging`.
119
-
* Improved logging. Added more log messages and added two notifications.
120
-
121
-
### 0.0.7
122
-
123
-
* Added `phpformatter.notifications` setting.
124
-
* The extension will now show a notification when the required settings are not set.
125
-
* The notification has a button that opens up a browser with the installation guide on the Github page.
126
-
* Added installation guide and known issue to the readme.
127
-
128
-
### 0.0.6
129
-
130
-
Added icon and more meta info in package.json. As well as the first icon!
131
-
132
-
### 0.0.5
133
-
134
-
Added working support for multiple file extensions besides .php. See `phpformatter.additionalExtensions` setting for more info.
135
-
136
-
### 0.0.4
137
-
138
-
All paths now support spaces (`' '`).
139
-
140
-
### 0.0.3
141
-
142
-
Setting `phpformatter.composer` to `true` now actually overrides the use of pharPath.
143
-
144
-
### 0.0.2
16
+
## Setup
145
17
146
-
* Code improvements.
147
-
* Fixed functionality.
148
-
* Improved code readability.
149
-
* Added setting to enable fixer logging. Logs all fixer results (including errors) to the console.
150
-
* Settings are now read every time the fix function is called. Previously settings were only read during activation.
18
+
Refer to our [wiki](https://github.com/Dickurt/vscode-php-formatter/wiki) for a quick and easy guide on how to install the extension and its dependencies.
151
19
152
-
### 0.0.1
20
+
##Configuration
153
21
154
-
Initial commit.
22
+
Want custom [keybindings](https://github.com/Dickurt/vscode-php-formatter/wiki/Extension-Commands)? Need specific [levels and fixers](https://github.com/Dickurt/vscode-php-formatter/wiki/Extension-Settings)? Check our [wiki](https://github.com/Dickurt/vscode-php-formatter/wiki)
0 commit comments