Code Monkey home page Code Monkey logo

coc-php-cs-fixer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

josecl glspdotnet

coc-php-cs-fixer's Issues

How to fix current file only?

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

PHP 8.1 gives an error because php-cs-fixer is not yet supported

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

Using wrong configuration

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.

Nothing happend after running :CocCommand php-cs-fixer.download

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.

How can I make the plugin autosave the changes?

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()

Format on save does (sometimes) not work with Pint

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:

  • Disabling all plugins except coc-nvim
  • Revert my config and use base coc-nvim from their readme
  • Pint from project and downloaded Pint by plugin

My coc-settings.json:

{
  "php-cs-fixer.activateTool": "pint",
  "coc.preferences.formatOnSaveFiletypes": [
    "php"
  ]
}

How does this work with coc-format-selected

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.