Box-Of-Hats / Bem-VSCode-Extension

A VSCode extension for helping with inserting BEM (Block-Element-Modifier) classes.
BSD 3-Clause "New" or "Revised" License
29 stars 5 forks source link

BEM Diagnostic Incorrect Reportings #9

Closed zeshanshani closed 5 years ago

zeshanshani commented 5 years ago

Hey! I have been enjoying this plugin a lot. Thanks a lot for putting so much effort in it! 💯

I have encountered one strange issue where the BEM diagnostics reports incorrectly when used in PHP file (see: https://s.zeshanahmed.com/a_2341ECB8.png).

It even gives false warnings in a pure PHP code: https://s.zeshanahmed.com/a_2341ED9D.png

Can you check what could be wrong and why it's giving such false warnings?

Thanks a lot, Zeshan

Box-Of-Hats commented 5 years ago

Thanks for the feedback :)

I'll take a look into this issue later today and see what I can do

Box-Of-Hats commented 5 years ago

I've been unable to replicate the issue, even after typing the examples in your screenshots.

Neither of these lines raise any diagnostic issues for me:

function zawp_generate_btn_classes( $classes = '', $btn_color = 'green', $outline = false)
<?php if ( have_rows( '_ctas') ): ?>

Could you provide the code that is causing the issue?

To clarify, these are my settings:

"bemHelper.classNameCase": "kebab",
"bemHelper.responsiveLinting": true,
"bemHelper.showDepthWarnings": true,
zeshanshani commented 5 years ago

@Box-Of-Hats that's strange. Are you checking it on .php files? It's basically raising errors on most of the PHP variables and functions as well (see: https://s.zeshanahmed.com/a_23451DC3.png)

e.g., here's another piece of code in a PHP file that I showed in the screenshot:

// If it has background image, add custom class.
if ( isset( $adv_styling['bg_image'] ) && $adv_styling['bg_image'] ) {
  $classes_arr[] = 'section--bg-image';
}

// If it has background image, add custom class.
if ( isset( $adv_styling['dark_bg'] ) && $adv_styling['dark_bg'] ) {
  $classes_arr[] = 'section--bg-dark';
}

And yes, the settings are as you mentioned.

Also, I'm afraid I'll have to disable the extension as it's very annoying seeing all those warnings on incorrect places. Happy to help further if you need.

Box-Of-Hats commented 5 years ago

I'm testing it on a .php file using the contents you provided but I'm still not getting any issues.

image

Although I've not been able to replicate the issue, I found a potential bug in the code which may have been causing it. I've released a new version (0.7.3) with this fix

If this still doesn't fix it for you, I recommend changing your settings to use "bemHelper.classNameCase": "any", as that will prevent BEM Helper from flagging up any classname casing issues it finds.

And big thanks to you for reporting this issue and helping make this extension better 🎉

Box-Of-Hats commented 5 years ago

I've finally managed to reproduce and find the source of this bug and I'll be working on a fix shortly

zeshanshani commented 5 years ago

Hey mate, sorry I forgot to respond to your earlier message.

I'll try the fix asap and will let you know if it helps.

And good to hear that you were able to reproduce the bug. Thanks for working on it! 🎉

Box-Of-Hats commented 5 years ago

Fix has been made and deployed in version ~0.7.4~ 0.7.5.

Let me know if this has fixed it for you or if you're still having issues

commit

zeshanshani commented 5 years ago

@Box-Of-Hats that works great. Thanks a lot! :)

However, I have encountered a few other issues. I'll open them up in a separate issue. Let's make this extension perfect for BEM users! 💯 🥇