Giter VIP home page Giter VIP logo

vscode-php-resolver's Issues

Files can't be saved when using php-cs-fixer automatically on save

When saving a PHP file with editor.formatOnSave enabled, php-cs-fixer runs and fixes the issues it can, but then places the changes into the file after the initial save command. This means any PHP files that still contain errors will show in the editor as an unsaved file.

The only way to save the file as is, is to either close the file and choose save in the dialog box that appears, or use the command pallet to save the file without formatting; both of which trigger an error that is placed in the output console. I think the proper way to handle this would be to sutomatically run php-cs-fixer, place the resulting code in the file (which is already being done), and then automatically trigger save without formatting so the file does not get stuck in a reformatting loop.

PS: Does your extension or vscode prompt (notify) All fixable errors were resolved when saving? Could that message be disabled or removed?

How can I use my project's phpcs.xml file?

Is there a way to automatically use the phpcs.xml file inside the current workspace?

Currently, I have to edit the settings manually if I change to a project that does not use the same standard.

"Fatal error occurred"

Hi there!

I'm excited to see a new extension that might be better than the existing ones :P

After installing the extension and opening a PHP file, I get a phpcs Fatal error occurred notification, and looking at the extension output I see this:

["INFO" - 4:41:36 PM] Switched to new file - starting code sniffer
["INFO" - 4:41:36 PM] phpcs - Dispose diagnostic collection
["INFO" - 4:41:36 PM] phpcs - The document URI file:///<some_redacted_path>/src/Bootstrap.php
["INFO" - 4:41:36 PM] phpcs - Extracting standards from the configuration
["INFO" - 4:41:36 PM] phpcs - Spawning the command with parameters - -q - --report=json --standard=
["INFO" - 4:41:36 PM] phpcs - Writing the extracted file content to the stdin
["INFO" - 4:41:36 PM] phpcs - No data received - exit
["INFO" - 4:41:36 PM] phpcs - Collecting the output finished starting parsing
["ERROR" - 4:41:36 PM] phpcs - Failed collecting proper output - Unexpected end of JSON input
["INFO" - 4:41:36 PM] phpcs - Received - 

As soon as I updated the paths to phpcs and phpcbf in the extension settings the error went away, so the "problem" is more like "the error message didn't accurately indicate what's wrong".

Seems like this could be resolved in a few ways:

  • don't pre-populate the path for phpResolver.phpSnifferCommand and force the user to configure it before it does anything
  • check that the executable exists/add a message if it doesn't
  • default to checking for a global phpcs or ./vendor/bin/phpcs
  • some combination of the above

Cheers!

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.