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

Not working after an HTML comment #14

Closed ndstephens closed 6 years ago

ndstephens commented 6 years ago

I can Hover, Peek, and Go To with any class in my HTML code before my first HTML comment, but nothing works following a comment. If i delete the comment then it'll work for all that followed it.

Anyone else experience this issue? I've disabled any comment related plugins I had. I'm on Mac High Sierra(10.13.2), VSCode 1.18.1 and your latest version (2.0.2). On a very small and simple project.

Thanks.

vasilescur commented 6 years ago

I'm having the same issue. I found that if I place some HTML content before my first comment, both that content and content after a comment work with CSS peek. As soon as it's gone, though, the comment seems to stop the extension from working.

On Windows 10, latest plugin version.

EDIT: looks like it's more specific: If the desired search term appears before the first comment, Peek will recognize it anywhere in the document. Otherwise, it won't recognize anything that doesn't appear before the first comment in an HTML file.

pranaygp commented 6 years ago

Oh. That seems like an odd issue. I suppose it has something to do with the HTML scanner I'm using (https://github.com/Microsoft/vscode-html-languageservice). I'll try to dig into it soon and figure out if it's an error in CSS Peek, or a dependency

ghost commented 6 years ago

@pranaygp I've found a workaround. Although the extension stops working after a <!--comment-->, it will continue working if you use the <comment> element.

pranaygp commented 6 years ago

I don't know how valid this page is, but it seems to imply that <comment> is deprecated and not supported by some browsers today. I wouldn't recommend that as a solution.

I'll try to poke around this issue soon (currently in the middle of studying for exams at school) and try to fix the actual issue

ghost commented 6 years ago

So far I've tested it on both Firefox 57.0.1 and Chromium 63.0.3239.84 and it works.

pranaygp commented 6 years ago

fixed this in version 2.0.3

vasilescur commented 6 years ago

Verified, the fix works for me on Windows 10, plugin version 2.0.3, VS Code 1.19.1. Thanks!

ghost commented 6 years ago

Thank you @pranaygp. It works!

cmdaltctr commented 2 years ago

Hi @pranaygp, I'm new to CSS peak, I just download the latest version and tried it and it's not working per issue 16 It says no definition for class.. I am using <!-- comment --> Update: it works now I just readd the file (with the corresponding HTML and CSS) and remove other unrelated files from my workspace.