npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coc-php-cs-fixer

v0.7.10

Published

PHP CS Fixer (PHP Coding Standards Fixer) and Laravel Pint extension for coc.nvim

Downloads

94

Readme

coc-php-cs-fixer

PHP CS Fixer (PHP Coding Standards Fixer) and Laravel Pint extension for coc.nvim

Install

:CocInstall coc-php-cs-fixer

Features

php-cs-fixer and laravel/pint are supported.

  • Formatter
  • Command
  • Code Action
  • Status Bar
  • pint.json Auto Completion and JSON validation
  • Downloader

Note

The formatter tool used is php-cs-fixer by default. If you want to use laravel/pint, change the php-cs-fixer.activateTool setting in coc-settings.json.

{
  "php-cs-fixer.activateTool": "pint"
}

Detects the php-cs-fixer or pint tool. They are prioritized in order from the top.

  1. php-cs-fixer.toolPath or php-cs-fixer.pint.toolPath
  2. vendor/bin/php-cs-fixer or vendor/bin/pint
  3. php-cs-fixer or pint retrieved by the download feature (:CocCommand php-cs-fixer.download or php-cs-fixer.pintDownload)
    • php-cs-fixer:
      • Mac/Linux: ~/.config/coc/extensions/coc-php-cs-fixer-data/php-cs-fixer
      • Windows: ~/AppData/Local/coc/extensions/coc-php-cs-fixer-data/php-cs-fixer
    • pint:
      • Mac/Linux: ~/.config/coc/extensions/coc-php-cs-fixer-data/pint
      • Windows: ~/AppData/Local/coc/extensions/coc-php-cs-fixer-data/pint

If "1" and "2" above are not detected, the download feature will be executed (The prompt will be displayed)

Usage

coc-php-cs-fixer can be executed in multiple ways.

Auto run when saving a file

Add the settings to coc-settings.json.

{
  "[php]": {
    "coc.preferences.formatOnSave": true
  },
}

If the file size is large or the tool (php-cs-fixer or pint) is slow in your environment, formatting may not work properly when saving. In coc.nvim, time-consuming formatting on save is canceled.

In that case, please perform the formatting in another way.

Run from CocCommand

  • If the php-cs-fixer.activateTool setting is php-cs-fixer
    • :CocCommand php-cs-fixer.fix
  • If the php-cs-fixer.activateTool setting is pint
    • :CocCommand php-cs-fixer.pintFix

Run formatting from call function

  • :call CocAction('format')

Run codeAction from call function

  • :call CocAction('codeAction')
    • If the php-cs-fixer.activateTool setting is php-cs-fixer
      • Choose action: "Run: php-cs-fixer.fix"
    • If the php-cs-fixer.activateTool setting is pint
      • Choose action: "Run: php-cs-fixer.pintFix"

Precedence of "php-cs-fixer" and "laravel/pint" configuration files and options

php-cs-fixer

  1. php-cs-fixer.config setting for this extension.
  2. .php-cs-fixer.php or .php-cs-fixer.dist.php config file in the workspace (project) root.
  3. options-reated settings for this extension. e.g. php-cs-fixer.rules and more.

pint

  1. php-cs-fixer.pint.config setting for this extension.
  2. pint.json config file in the workspace (project) root.
  3. options-reated settings for this extension. php-cs-fixer.pint.preset.

Configuration options

  • php-cs-fixer.enable: Enable coc-php-cs-fixer extension, default: true
  • php-cs-fixer.activateTool: Formatter tool to be used, valid option ["php-cs-fixer", "pint"], default: "php-cs-fixer"
  • php-cs-fixer.toolPath: The path to the php-cs-fixer tool, default: ""
  • php-cs-fixer.config: Path to php-cs-fixer config file (--config), default: ""
  • php-cs-fixer.useCache: Use a cache file when fixing files (--using-cache), default: false
  • php-cs-fixer.allowRisky: Determines whether risky rules are allowed (--allow-risky), default: false
  • php-cs-fixer.rules: Rules to use when fixing files (--rules), e.g. "@PSR12,@Symfony", default: "@PSR12"
  • php-cs-fixer.enableIgnoreEnv: Add the environment variable PHP_CS_FIXER_IGNORE_ENV=1 and run php-cs-fixer, default: false
  • php-cs-fixer.pint.toolPath: The path to the pint tool, default: ""
  • php-cs-fixer.pint.config: Path to pint.json config file (--config), default: ""
  • php-cs-fixer.pint.preset: Presets define a set of rules that can be used to fix code style issues in your code (--preset), valid option ["laravel", "psr12", "symfony"], default: "laravel"
  • php-cs-fixer.downloadCheckOnStartup: If php-cs-fixer or pint is not present at startup, run the built-in download. The tool to be downloaded will follow the php-cs-fixer.activateTool configuration, default: true
  • php-cs-fixer.downloadMajorVersion: Specify the major version of php-cs-fixer to download for the extension, valid option [2, 3], default: 3
  • php-cs-fixer.enableFormatProvider: Enable format provider, default: true
  • php-cs-fixer.enableActionProvider: Enable codeAction provider, default: true
  • php-cs-fixer.terminal.enableSplitRight: Use vertical belowright for dryRunDiff and pintTest terminal window, default: false

Commands

  • php-cs-fixer.fix: Run php-cs-fixer fix
  • php-cs-fixer.dryRunDiff: Run php-cs-fixer fix with --dry-run and --diff in a terminal window | DEMO
  • php-cs-fixer.pintFix: Run pint
  • php-cs-fixer.pintTest: Run pint with --test in a terminal window | DEMO
  • php-cs-fixer.download: Download php-cs-fixer
    • By default, the "v3" series will be downloaded. If you want to download "v2" series, please change the php-cs-fixer.downloadMajorVersion setting.
  • php-cs-fixer.pintDownload: Download pint
  • php-cs-fixer.showOutput: Show php-cs-fixer output channel

Code Actions

  • Run: php-cs-fixer.fix
  • Run: php-cs-fixer.pintFix

Thanks

License

MIT


This extension is built with create-coc-extension