pranaygp / vscode-css-peek

A vscode extension for peeking at CSS definitions from a class or id tag in HTML
MIT License
146 stars 32 forks source link

Doesn't work in .php files. #36

Closed Dserma closed 4 years ago

Dserma commented 6 years ago

Hi.

I'm using this plugin in a WP project, and it doesn't work in my .php files. My "css_peek.activeLanguages" are with "php" included, but the "go to definition" doesn't run. If i change the type of the file to "html", it works.

My config: "css_peek.activeLanguages": [ "html", "ejs", "erb", "php" ]

VS Code Version: Versão 1.24.1 Ubuntu 16.04 amd64 CSS Peek Version: 2.1.0

EDIT -------

The plugin run and write in console that it found the selector, but, the CSS file isn't opened, only with PHP files. I've tested with another file types, like "jade", "ini" and "sql", and the CSS file was opened correctly, only when i try with any PHP file the CSS file doesn't open.

programming-enthusiast commented 6 years ago

Same issues to me! Have you found a way to resolve issues?

commwork commented 6 years ago

Same here, gives me lots of random files which do not contain the definition.

mhluzi commented 6 years ago

Is there perhaps some setting we could tweak to get this to work with .php files?

mhluzi commented 6 years ago

I have php in css_peek.activeLanguages:

"css_peek.activeLanguages": [ "html", "ejs", "erb", "php" ]

So not sure why it is not working...

Shujee commented 5 years ago

OK. I think I made it work. I'm using it for Laravel Blade files that use *.blade.php extension. It will hopefully work for other php files too, but I haven't tested that.

Here is what I did.

  1. Install extension (of course).
  2. Edit css_peek.activeLanguages setting and add "blade" to the list. "php" should already be in the list by default, but if not, add that too.
  3. Restart VS Code (simple Reload didn't work for me).
  4. Hover mouse over a css class name in your php file while keeping CTRL key down. It will be link-highlighted and clicking it will take you to class definition.

One strange thing is that it works for most css classes but not for some, e.g. one of my elements has got these classes applied to it:

class="table table-striped table-bordered table-hover"

Hovering on fisrt and third classes works, while second and fourth classes do not highlight. Mind you that these are Bootstrap classes and are available in minified form only, so that could be causing it.

pranaygp commented 4 years ago

All these issues should be resolved in the latest version of CSS Peek (4.0.0+)

Please make sure to update your extension settings from css_peek.activeLanguages since that is not longer valid. You'll see the new configuration settings available from your VSCode settings