Search code examples
javascripthtmlstringwebstormjetbrains-ide

Lighting and transitions for custom attribute values ​in WebStorm


I have string literals in javascript code and they have attributes whose values ​​are methods, for example:

const test = `<div data-click="foo">test<div>`;

function foo() {}

And I'm trying to make "foo" highlighted separately, not just as a string, and so that you can use ctrl+b to go to the method:

enter image description here

I'm trying to use Language injection what am I doing wrong?


Solution

  • I believe this can be achieved by copying the built-in setting “*/@on.” and replacing the argument “on” with “data-click.” However, in my case, the configuration persistence after editing turned out to be broken.

    enter image description here

    enter image description here

    enter image description here