Supplying PHP Storm with a list of data attributes for code completion?
Is there any way to supply PHPStorm with a list of data attribtues to use for code completion in HTML?
A lot of frameworks use data attributes extensively, and it would be nice to have easy access to the attributes used.
Thanks,
请先登录再写评论。
You can add all your data attributes to 'Custom HTML tag attributes' list in Settings/Editor/Inspections/HTML/Unknown HTML tag attribute: attributes from this list will be shown up in completion list and not reported as not allowed
Much thanks!
I have several custom HTML tags that are used by the framework. Specifically, e.g.
means that the tag will generate a call to a Javascript function upon change, and more importantly, that the call will be to the foo.bar.baz() object.
It would be therefore great if I could click on the “bar” section of the HTML data-attribute and be sent to the file defining that particular Javascript data object, or on “baz” and be taken to the function body.
To do so, I enter
Settings > Editor > Language Injections
and add a new XML injection:
All other fields blank. OK, Apply, and my tag is now clickable and working.