Suggestion: Enable jQuery-Esque CSS Query-Completion regardless of Library

Hey there,

while working with the popular D3 library I wondered if it was possible to use Autocompletion for CSS-Queries for HTML-Tags (and maybe css Classes) already defined for other libraries than Jquery, where this feature is already included (aswell as "document.getElementById"). Maybe I should make it more clear by an Example.

If I write

$(''#")

WS suggests me a list of the IDs all already defined HTML elements (AWESOME). Same goes for classes, element types etc.

D3 has quite a similar approach by using

d3.select('#')

But this doesnt give me any completion. Which I know isn't a mistake. As Webstorm already knows the IDs of HTML-Elements, would It be possible to make them available in another context for autocompletion?

Hope I made my point clear. 

0
2 comments

This would require adding special support for d3.select('#');

Note that you can inject CSS in this string manually: put cursor within quotes, hit Alt+Enter, choose Inject language or reference, select JQuery-CSS from the list:

Note that you can make this injection permanent by adding // language=JQuery-CSS comment:

 

// language=JQuery-CSS
d3.select('#id')
1
Avatar
Permanently deleted user

AWESOME! Exactly what I was looking for. It would be even better if this would be a tad faster (possibly by a template, that always includes Jquery-CSS), maybe I can work something out by myself. But this really helps me already :).

0

Please sign in to leave a comment.