Closed gabrielbidula closed 3 years ago
run the below nvim cmd on a php buffer and make sure the phpcbf was executed.
:lua require'phpcs'.cbf()
Yes, I tried but it doesn't do anything, not even display an error, can we debug it somehow?
I've an option to disable phpcbf. Make sure the g.disable_cbf option is not set or set it to zero as below
:let g:disable_cbf=0
But I do want it enabled, didn't get it. I dont see any output when running :lua require'phpcs'.cbf()
Added two new helper to read the stdout and stderr
:lua require'phpcs'.get_last_stdout()
:lua require'phpcs'.get_last_stderr()
Good, so I can see this output when I run :lua require'phpcs'.cs()
STDIN:23:25: error - Parentheses must be used when instantiating a new class
STDIN:34:27: error - Parentheses must be used when instantiating a new class
Press ENTER or type command to continue
But no stdout or stderr for :lua require'phpcs'.cbf()
, weird.
It seems it is not even running.
after :lua require'phpcs'.cbf()
,
:lua require'phpcs'.get_last_stdout()
to get the output of the previous cmd. :lua require'phpcs'.get_last_stderr()
to get the stderr of the previous cmd.Yes, I did it before, as I said, there is not output for both commands, it works when the command is:lua require'phpcs'.get_last_stdout()
although. Something is missing with the cbf command.
@praem90 Another detail, after adding the autocmd calls to my init.vim I get the below error. It shows this handle error whenever I open a buffer or save it.
Thanks for reporting. It will be fixed ASAP
Made some fixes and improvements. You can get the latest one. Hope no more bugs :grin:
@praem90 Okay thanks! I just updated and now I cannot see the errors being displayed on the buffer in any case as before ie: opening, editing, or saving the file. I am able to see the output being created via the command :lua require'phpcs'.get_last_stdout()
as you can see in the print below. Do we need a different setup on init.vim?
Yes, You may have to enable on your vim config.
You can see that there is no space to display diagnostic errors/warnings on the left to the line numbers as like as seen in the previous screenshots.
Hi @praem90 , I didnt touch my setup on, still has the same config.
autocmd!
autocmd BufWritePost,BufReadPost,InsertLeave *.php :lua require'phpcs'.cs()
autocmd BufWritePost *.php :lua require'phpcs'.cbf()
augroup END
let g:nvim_phpcs_config_phpcs_path = '/Users/gabriel/.composer/vendor/bin/phpcs'
let g:nvim_phpcs_config_phpcbf_path = '/Users/gabriel/.composer/vendor/bin/phpcbf'
let g:nvim_phpcs_config_phpcs_standard = 'PSR12'
I didn't get what you mean by there is no space as it is the same setup as the other images, the only thing is that I do not see the diagnostic in line but on require'phpcs'.get_last_stdout(). On top of that, I am able to see in-line diagnostics for errors that are not coming from phpcsf ie: inteliphense, so I would assume something changed here.
FYI @praem90
Still, I am not able to make it work.
@gabrielbidula I have fixed an issue. Please checkout the latest code and try again.
First of all, good job on making this plugin, really handy.
I am trying to figure why phpcbf is not working on neovim, follows a screenshot with the error.
On the terminal, phpcbf works with no issue.
This is my neovim config.
Thanks