sublime-phpcs icon indicating copy to clipboard operation
sublime-phpcs copied to clipboard

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

Open pierresh opened this issue 3 years ago • 7 comments

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

pierresh avatar Apr 10 '21 02:04 pierresh

Hey @pierresh

Is extensions_to_execute defined in your settings to PHP?

benmatselby avatar Apr 10 '21 07:04 benmatselby

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

pierresh avatar Apr 10 '21 09:04 pierresh

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.

benmatselby avatar Apr 10 '21 12:04 benmatselby

alright, thanks for your feedback

pierresh avatar Apr 10 '21 13:04 pierresh

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

srichter avatar Apr 21 '21 10:04 srichter

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

pierresh avatar Apr 21 '21 15:04 pierresh

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.

srichter avatar Apr 21 '21 15:04 srichter