Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yaegassy/coc-phpstan
PHPStan (PHP Static Analysis tool) extension for coc.nvim
https://github.com/yaegassy/coc-phpstan
coc coc-extensions coc-nvim linter neovim php vim
Last synced: 19 days ago
JSON representation
PHPStan (PHP Static Analysis tool) extension for coc.nvim
- Host: GitHub
- URL: https://github.com/yaegassy/coc-phpstan
- Owner: yaegassy
- License: mit
- Created: 2021-05-26T09:37:06.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-09T02:17:36.000Z (over 1 year ago)
- Last Synced: 2024-10-18T06:36:35.582Z (23 days ago)
- Topics: coc, coc-extensions, coc-nvim, linter, neovim, php, vim
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@yaegassy/coc-phpstan
- Size: 164 KB
- Stars: 14
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coc-phpstan
[PHPStan](https://phpstan.org/) (PHP Static Analysis tool) extension for [coc.nvim](https://github.com/neoclide/coc.nvim).
## Install
**CocInstall**:
```vim
:CocInstall @yaegassy/coc-phpstan
```> scoped package
**vim-plug**:
```vim
Plug 'yaegassy/coc-phpstan', {'do': 'yarn install --frozen-lockfile'}
```## Features
- Linter
- CodeAction
- Downloader## Detect tool: phpstan
1. `phpstan.toolPath` setting
1. `vendor/bin/phpstan` (project)
1. Extension-only `phpstan` retrieved by the download feature (`:CocCommand phpstan.download`)
- Mac/Linux: `~/.config/coc/extensions/@yaegassy/coc-phpstan-data/phpstan`
- Windows: `~/AppData/Local/coc/extensions/@yaegassy/coc-phpstan-data/phpstan`## "phpstan.neon", "phpstan.neon.dist" or "phpstan.dist.neon" configuration file
If you wish to use a [configuration file](https://phpstan.org/config-reference) you should place the `phpstan.neon`, `phpstan.neon.dist` or `phpstan.dist.neon` file in the root of your project folder
## Linting of NEON file
This extension includes a feature to perform linting using the `neon-js` library in a phpstan configuration file (`phpstan.neon`, `phpstan.neon.dist` or `phpstan.dist.neon`).
To run this linting feature, the filetype must be `neon`.
Install "neon" related plugin (e.g. [yaegassy/nette-neon.vim](https://github.com/yaegassy/nette-neon.vim)).
---
- [DEMO](https://github.com/yaegassy/coc-phpstan/pull/2#issue-1700077931)
## Configuration options ("coc-settings.json" or ".vim/coc-settings.json")
- `phpstan.enable`: Enable coc-phpstan extension, default: `true`
- `phpstan.toolPath`: The path to the phpstan (Absolute path), default: `""`
- `phpstan.level`: Specifies the rule level (0 - 9 and max) to run, If you apply this setting, the level setting in the phpstan.neon file will be ignored, e.g. valid option `"9"`, `"max"`, default: `null`
- `phpstan.configuration`: Specifies the path to a configuration file, default: `null`
- `phpstan.memoryLimit`: Specifies the memory limit in the same format php.ini accepts, Example: -1, 1024M, 2G, default: `"-1"`
- `phpstan.download.checkOnStartup`: Perform built-in download if phpstan is not present at startup, default: `true`
- `phpstan.neonLint.enable`: Enable neon-js lint (diagnostics). It will only work if the file name is `phpstan.neon`, `phpstan.neon.dist` or `phpstan.dist.neon`, default: `true`## Commands
- `phpstan.download`: Download PHPStan
- `phpstan.showOutput`: Show phpstan output channel## Code Actions
**Example key mapping (Code Action related)**:
```vim
nmap ga (coc-codeaction-line)
```**Usage**:
In the line with diagnostic message, enter the mapped key (e.g. `ga`) and you will see a list of code actions that can be performed.
**Actions**:
- `Add @phpstan-ignore-next-line`
- `Add @phpstan-ignore-line`## Thanks
- [phpstan/phpstan](https://github.com/phpstan/phpstan)
- [matej21/neon-js](https://github.com/matej21/neon-js)## License
MIT
---
> This extension is built with [create-coc-extension](https://github.com/fannheyward/create-coc-extension)