Skip to content

Commit

Permalink
feat: supports old phpfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed May 3, 2023
1 parent 796e9f7 commit df93c69
Show file tree
Hide file tree
Showing 13 changed files with 513 additions and 74 deletions.
5 changes: 4 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ yarn.lock
prettier.config.*js
.eslintrc.*js
*.log
node_modules/**/.vscode
node_modules/**/*.md
node_modules/**/*.ts
node_modules/**/*.txt
node_modules/**/LICENSE*
node_modules/**/license*
node_modules/**/test/*
node_modules/node-fetch/**
node_modules/whatwg-url/**
node_modules/sha1-file/**
node_modules/webidl-conversions/**
node_modules/tr46/**
node_modules/dayjs/esm
node_modules/dayjs/locale
node_modules/dayjs/plugin
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ The missing phpfmt extension for Visual Studio Code.

## Installation

Open command palette `<kbd>`F1`</kbd>` and select `Extensions: Install Extension`, then search for phpfmt.
Open command palette `F1` and select `Extensions: Install Extension`, then search for phpfmt.

**Note**: PHP 7.x or newer is required in the machine to run this plugin.


## Usage

`<kbd>`F1`</kbd>` -> `phpfmt: Format This File`
`F1` -> `phpfmt: Format This File`

or keyboard shortcut `Ctrl + Shift + I` which is Visual Studio Code default formatter shortcut

Expand All @@ -32,7 +32,7 @@ You can turn off format-on-save on a per-language basis by scoping the setting:
"editor.formatOnSave": false,
// Enable per-language
"[php]": {
"editor.formatOnSave": true
"editor.formatOnSave": true
}
```

Expand All @@ -50,6 +50,8 @@ A: Wrap your path with quotes like:
It is recommended to add the directory of the `php.exe` to the PATH environment variable on Windows.
If it still not working, refer to [#1](https://github.com/kokororin/vscode-phpfmt/issues/1) and [Stack Overflow Related](https://stackoverflow.com/a/45765854).


<!--
Q: How use tabs instead of spaces with PSR2 enabled ?
A: For [PSR2](https://www.php-fig.org/psr/psr-2/), code MUST use 4 spaces for indenting, not tabs. But if you like PSR2, and do not like 4 spaces for indentation, add following configuration:
Expand All @@ -70,16 +72,19 @@ A: For [PSR2](https://www.php-fig.org/psr/psr-2/), code MUST use 4 spaces for in
"phpfmt.psr2": false
}
```
-->

Q: Is fmt.phar (phpfmt itself) still maintained ?
A: Since phpfmt has no maintainers, only Serious bugs will be fixed.
~~A: Since phpfmt has no maintainers, only Serious bugs will be fixed.~~
A: We now use `fmt.stub.php` from driade's [phpfmt8](https://github.com/driade/phpfmt8) which is very updated.

## Configuration

<!-- Configuration START -->
| Key | Type | Description | Default |
| -------- | ----------- | ----------- | ----------- |
| phpfmt.php_bin | `string` | php executable path | "php" |
| phpfmt.use_old_phpfmt | `boolean` | use old fmt.phar which supports 5.6 | false |
| phpfmt.detect_indent | `boolean` | auto detecting indent type and size (will ignore indent_with_space) | false |
| phpfmt.psr1 | `boolean` | activate PSR1 style | false |
| phpfmt.psr1_naming | `boolean` | activate PSR1 style - Section 3 and 4.3 - Class and method names case. | false |
Expand All @@ -99,7 +104,7 @@ A: Since phpfmt has no maintainers, only Serious bugs will be fixed.

## Supported Transformations

`<kbd>`F1`</kbd>` -> `phpfmt: List Transformations` to get the example of each
`F1` -> `phpfmt: List Transformations` to get the example of each
transformation.

<!-- Transformations START -->
Expand Down Expand Up @@ -182,12 +187,12 @@ transformation.

### Running extension

- Open this repository inside VSCode
- Open this repository inside Visual Studio Code
- Debug sidebar
- `Launch Extension`

### Running tests

- Open this repository inside VSCode
- Open this repository inside Visual Studio Code
- Debug sidebar
- `Launch Tests`
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed logo.png
Binary file not shown.
Loading

0 comments on commit df93c69

Please sign in to comment.