pucelle / vscode-css-navigation

Allowing Go to definition from HTML to CSS, or Find References from CSS to HTML.
https://marketplace.visualstudio.com/items?itemName=pucelle.vscode-css-navigation
MIT License
64 stars 8 forks source link

[Feature Request] Supports property selector #53

Open pucelle opened 3 years ago

pucelle commented 3 years ago

HTML codes:

<button primary>...

CSS codes:

 button[primary]{...}

Should goto CSS definition when cursor at primary in HTML codes and presses F12. And should have right auto completion label primary for HTML codes.

WebMechanic commented 2 years ago

this looks like an attribute selector to me, although there is no attribute "primary" for the HTML button element.

Having that for data and aria attributes would be very useful -- and whatever the HTML language server knows about (valid) HTML element attributes.

<button type="submit" 
        data-stuff="some fancy thing" 
        aria-labelledby="other-element-id">Send</button>
button[type] {}
button[type=submit] {} /* no quotes */
button[type="submit"] {} /* quotes */
button[data-stuff ~= "fancy"] {}
button[aria-labelledby ^= "other"] {}
button[aria-labelledby $= "id"] {}
button[aria-labelledby *= "element"] {}
pucelle commented 2 years ago

Well, thanks for your detailed commands, will work on it in my next vocation.