Reputation: 549
Is it possible to use phplint and phpcs with Visual Studio Code editor?
It seems that it's possible with Visual Studio Code tasks, is it right? If yes, how?
Visual Studio Code Tasks
Upvotes: 3
Views: 2042
Reputation: 250962
This is a very basic example of a PHPLint task for Visual Studio Code. It isn't very sophisticated, but you will see that it gets things working.
A more sophisticated Regular Expression is needed to properly identify which lines are errors, which are warnings, and which don't matter at all.
{
"command": "C:\\phplint\\phpl.bat",
"version": "0.1.0",
"args": [
"C:\\Code\\index.php"
],
"problemMatcher": {
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(.*)$",
"message": 1
}
}
}
I am using a custom problem matcher to parse the output of PHPLint. The pattern has a regexp, which parses the output of PHPLint, followed by a list of what is in each position (in this case, I am just treating the whole line as a "message" - a bit too basic, but you get the idea).
This is essentially how you would create a task for anything you can access on the command line.
Upvotes: 2