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] Match Entire Selector in "Find All References" #50

Open kdumontnu opened 3 years ago

kdumontnu commented 3 years ago

The concept for this extension is great, but I'm really hoping that the tool can match an entire CSS selector when I select "Find All References"

For instance:

.ui.secondary.pointing.menu .item {
  // properties
}

In this case, I'd like the filter to find any elements matching the exact selector. I can achieve this by building regex searches: ^.*<.*class=(?=.*ui)(?=.*secondary)(?=.*menu)(?=.*pointing).*>(.|\n)*<.*(?=.*item) ^ Note: this regex probably needs some work.

Of course, it will take a lot of work to get 100% coverage for all CSS selector properties, but even basic selectors like above would provide a lot of value for me understanding if a CSS change will affect other areas of my code.

Happy to help or provide additional details.

pucelle commented 3 years ago

Thanks for your suggestion, kdumontnu, you are right, what you are thinking about is a very helpful and even exciting work.

In fact I've considered much about this, for finding definitions and references to make it match all nested selectors.

My answer is I can make this done, but it will cost me much time (may be a whole week or even two, not long, but I have a daily work), and it may also affect searching performance (may be not, searching is super fast right now).

I'v received another two issues having the same suggestion, so I guess I should consider more about this.

kdumontnu commented 3 years ago

@pucelle Thanks for the reply. I'm happy to help out. Yes, to have 100% coverage would take a LOT of work, but I believe the task can easily be broken up into a roadmap you can share with users. Once the initial architecture is set up I'm sure you can get people to help contribute.

pucelle commented 3 years ago

Thanks, @kdumontnu, I will add this feature to my to-do list. Otherwise, any suggestion would be welcome.