-
Notifications
You must be signed in to change notification settings - Fork 57
Add "extensions" configuration setting #172
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
base: develop
Are you sure you want to change the base?
Conversation
|
Thanks for that @theteknocat, I think that's what I've been looking for a while. |
|
@davids4 that's a great question. I don't actually know how the source code for the extensions gets compiled out into the final shipping version of the Javascript code that's used for the VSCode extension. I haven't built extensions for VSCode before, nor worked with this particular kind of codebase. What I did was modified my copy of the extension first, by going into ~/.vscode/extensions/ikappas.phpcs-1.0.5 and editing the appropriate files. I then cloned a copy of the git repo and made the same kinds of changes in the source code files so that I could commit that and create this pull request. If anyone knows how to compile it into the ready to use VSCode extension, I'd love to hear about it too. In the meantime, I have attached a zipped up copy of my modified extension that you can use right now until such time as this (hopefully) gets merged and included in a future version of the extension that you can just install/update with VSCode extension manager. Unzip the attached file and overwrite ~/.vscode/extensions/ikappas.phpcs-1.0.5 with the contents of the zip. Unfortunately if you reinstall via the extension manager, or install an update that way later on, this will be overwritten. |
|
Thanks so much @theteknocat! I was doing just that :D 👍 haha You saved me quite some time and during which I was able to test your zipped package of the patched extension. I have attached a patch as well to the VSCode extension: Hopefully your pull request will be approved and we'll be able to use this feature as part of the next update in vscode's marketplace. |
|
@ikappas any chance you will consider accepting this pull request and including this feature in a future release of the VSCode extension? |
|
Is there a reason not used a phpcs.xml file for adding extension in the working project directory? I've used the zipped file at one point and it worked great, but really not needed as you can get around that by defining how you want your phpcs to code sniff. |
Oh, ha! No reason at all, I just wasn't aware of that. Perhaps that actually makes more sense. |
|
I think for many people as #159 points out, it is problematic to add a phpcs.xml file and better to provide a configurable form/option to choose which extensions should be checked through the UI - better user experience over all since this is an extension and can provide this added functionality. User can always add a phpcs.xml file so this is an enhancement over existing functionality. |
|
@jaybabak that's true, though there are so many different configuration options you may need, depending on your specific situation, plus the configuration is often project-specific. If you work with a team of people and you need to ensure that everyone is using the same PHPCS configuration for each project, then the best option is to use phpcs.xml file in the repository that you commit or setup a pre-commit hook to do the linting with your specified configuration to ensure everyone on the team is meeting the right coding standards. Those solutions are great especially if different devs on the team aren't all using the same coding software or IDE. We have a contractor, for example, who uses PHPStorm. So we just require that he has PHPCS installed and configured and the phpcs.xml file will allow it to correctly lint his code. However, as you say that is not necessarily feasible for everyone. So if the vscode extension also allowed every conceivable configuration option, including this one in particular, then any given developer can use whatever means works best for them in their situation. |
Offer this to resolve #159. I'm not 100% sure if I got it right. I was able to hack my installed version of the extension to make this work, and did my best to copy those changes to the source code.
I hope this can be modified to work and accepted, as many people will find this helpful, especially those who work with Drupal that uses a number of different file extensions for PHP code.