benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
814 stars 126 forks source link

Display context menu "PHP Code Sniffer" only in PHP files #200

Open pierresh opened 3 years ago

pierresh commented 3 years ago

Hello,

I think it would be better if the context menu "PHP Code Sniffer" is displayed only in PHP files. I am working on Typescript files and it still appears while this is not relevant in that case. Thanks!

WX20210410-101404@2x
benmatselby commented 3 years ago

Hey @pierresh

Is extensions_to_execute defined in your settings to PHP?

pierresh commented 3 years ago

Thanks a lot for your prompt feedback. Yes extensions_to_execute is set to php

Also, I run Subline Text 3 version 3.2.2, build 3211

WX20210410-174627@2x
benmatselby commented 3 years ago

Ok. I have to be honest and say I've not used Sublime in about 3 years and I'm no longer using PHP. Therefore it's unlikely I'll be able to fix or implement this any time soon. I hope you understand.

pierresh commented 3 years ago

alright, thanks for your feedback

srichter commented 3 years ago

Unfortunately this isn't possible yet, see https://github.com/sublimehq/sublime_text/issues/1859 and https://github.com/sublimehq/sublime_text/issues/1095

pierresh commented 3 years ago

I think it is possible because that is already the case with JsPrettier. This appears in the sub-menu when files can be formatted with Prettier, but not in others.

Per example, you can see JsPrettier in my screenshots above with PHP and Typescript files. Then, if I open the configuration file of MySQL (which is not supported by Prettier), that JsPrettier is then no more available in the sub-menu.

WX20210421-234342@2x
srichter commented 3 years ago

It's possible with JsPrettier because it's only a single menu item, not an expandable menu item that contains multiple other items. That's what the linked issues are about.