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] Support array value #59

Closed Ttou closed 3 years ago

Ttou commented 3 years ago

hope array value can work

<div class={['main', { show: this.show }]}></div>
pucelle commented 3 years ago

Certainly, will implement it soon.

Ttou commented 3 years ago

you can implement it like this

image

pucelle commented 3 years ago

For the long term, will implement a new syntax parser instead of only parsing character tokens. It will cost some time.

VadimKalinin commented 3 years ago

Pucelle, I don’t navigate to css from this jQuery selector: $(‘#id-name1 .class-name1 input[checked:true]’), for each part of this selector. Is this possible in future? Thank you for your answer, with best regards, Vadim

pucelle commented 3 years ago

In fact, parsing the jquery selector should be very easy after the new syntax parser implemented, while rest part may be not easy, which should be separated into 2 levels:

  1. Navigate to all the input[checked:true] selectors in CSS files, this is what can be done easily right now.
  2. Navigate to the right #id-name1 .class-name1 input[checked:true], with all the parent selectors match. difficult, have a plan to do so (and also a feature request https://github.com/pucelle/vscode-css-navigation/issues/50).

Otherwise, I just guess, may the jquery selector should be navigated to HTML tags? or both HTML tags and css selectors.

VadimKalinin commented 3 years ago

Thank you, Pucelle, for your answer. I will wait for the new syntax parser implementation. Good luck with this task

pucelle commented 3 years ago

Released v1.11.0, goto definition and auto completion for <div class={['main', { show: this.show }]}></div> should work now. (Finding references is not fully supported, need some time to develop and may not useful enough).

Otherwise, jQuery selectors like $(‘#id-name1), $(.class-name1`) should work too, but it matches only one selector, ignores nesting.