yaegassy / coc-php-cs-fixer Goto Github PK
View Code? Open in Web Editor NEWPHP CS Fixer (PHP Coding Standards Fixer) and Laravel Pint extension for coc.nvim
Home Page: https://www.npmjs.com/package/coc-php-cs-fixer
License: MIT License
PHP CS Fixer (PHP Coding Standards Fixer) and Laravel Pint extension for coc.nvim
Home Page: https://www.npmjs.com/package/coc-php-cs-fixer
License: MIT License
Simply
A/
.php-cs-fixer.php
B/
.php-cs-fixer.php
src/
files..
go inside of B directory and run 'nvim'. After open a php file and save file (so format on save). This plugin uses configuration that inside of A directory, not B. Both are git repository.
Is it possible to load any phpcs.xml containing a ruleset?
Hi,
I have a very strange issue with the plugin using Pint.
It does not work with format on save but when I run the :Format
(from the base coc-nvim config) it does the job..
In the showOutput
it shows that Pint ran and when I debugged the plugin in the class PintFixFormattingEditProvider
the function _provideEdits
var code
has the formatted document.
Been trying to figure out why this is happening but cant solve it.
Also strange is that when I create a new PHP file in my project is does work.
What i've tried:
My coc-settings.json:
{
"php-cs-fixer.activateTool": "pint",
"coc.preferences.formatOnSaveFiletypes": [
"php"
]
}
I'm having an issue at the moment where the plugin fixes the file, but the fixes are not saved automatically.
I've tried to add an auto command but it's still saving before the formatting. So I have to save twice to have the formatting changes saved properly.
autocmd BufWritePre *.php silent! call CocCommand php-cs-fixer.fix
I've managed to make it work by adding a sleep
but I don't think that's ideal.
function! PhpFixFile()
CocCommand php-cs-fixer.fix
sleep 700m
endfunction
autocmd BufWritePre *.php call PhpFixFile()
It seems that it is not yet supported at this time. Therefore, it outputs an error and cannot be executed.
The workaround at the moment is to use the environment variable PHP_CS_FIXER_IGNORE_ENV
. However, this may not result in the expected correct formatting.
bashrc, etc...:
export PHP_CS_FIXER_IGNORE_ENV=1
The following command works under my project root:
./vendor/bin/php-cs-fixer fix --ansi
But nothing happend after running :CocCommand php-cs-fixer.download
in vim. Files that can be formatted by the plain command cannot be formatted by this CocCommand.
I was trying to figure out how this works with coc-format-selected
.
In the recommended settings they have the following key mappings:
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
When I use that key mapping the code is formatted but I'm not sure it's using this extension.
Does coc-format-selected
use this extension under the hood? And if not, is there a way to tell it to?
It looks like the configuration "php-cs-fixer.enableFormatProvider:": true,
has no effect and is not recognized. :Format
doesn't work for now.
Hi,
I was wondering if the action php-cs-fixer.fix
only fixing the current file or the whole directory? I have it configured to fix automatically upon saving a file, and sometimes I see weird behaviour of my file getting updated as I type, so I have a feeling that it is fixing the whole directory.
If so, is there a way to only fix current buffer/file?
I'm using this to apply the fixes automatically:
autocmd BufWritePost *.php silent! CocCommand php-cs-fixer.fix
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.