Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: documentation for installation on Visual Studio Code #74

Open
vivaldus opened this issue Mar 15, 2019 · 1 comment
Open

Feature: documentation for installation on Visual Studio Code #74

vivaldus opened this issue Mar 15, 2019 · 1 comment

Comments

@vivaldus
Copy link

I've been fiddling around with VSCode plugins, phpcs config, and integrating this plugin for several hours now. I've never used phpcs before and find the whole ecosystem quite confusing. It would be really helpful to see a step-by-step guide to get Variable Analysis working in VSCode. Simply put, I'd like to see VSCode highlight variable typos as soon as they happen. Thanks.

@sirbrillig
Copy link
Owner

sirbrillig commented Mar 18, 2019

That's a good idea! Here's my notes from when I last set this up for VSCode, which may help you for right now, but a proper section of the README would be best.

Visit the extension page for VSCode phpcs and click "Install". Once it has installed, click "Reload" in the VSCode extension window or just reload the window by opening the command palette (command-P) and typing "reload".

Once the extension is installed, there are several ways to add the ruleset to a project. The simplest is probably to add a composer.json file to your project directory, then install following the instructions on the README:

composer require --dev dealerdirect/phpcodesniffer-composer-installer
composer require --dev sirbrillig/phpcs-variable-analysis

Next, create a file like this as a phpcs.xml file in your project directory:

<?xml version="1.0"?>
<ruleset name="MyStandard">
    <rule ref="VariableAnalysis"/>
</ruleset>

After that, it should just work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants