custom tags with formatting/highlighting

Hello, in my current project we have custom tags such as <isscript> and we need them to be treated by the ide as basically javascript formatting and syntax highlighting, but I cannot figure out how to accomplish this. If anyone has a solution please help.

1
14 comments

You can add this tag in Settings/Preferences | Editor | Inspections | HTML | Unknown HTML tag > Options > Custom HTML tags

0
Avatar
Permanently deleted user

I have added this tag, but theres no settting for telling it to treat this tag like javascript

0

You can try creating a custom language injection for your tag in Settings | Editor | Language Injections:

WebStorm will inject JavaScript in it then:

1
Avatar
Permanently deleted user

EDIT:

I figured it out, my editor didnt have the /html namespace option only xhtml and I didnt notice the difference. manually setting to html fixed it. Thank you so much.

 

This solution looks promising, but for whatever the reason it isn't working on mine. I added the xml injection exactly like you are. So I guestt I have to ask the question in your output example, what is the file type/extension you are using? Or does that matter?

0
Avatar
Permanently deleted user

I am having a strange result from this though. I am not sure why, but the editor is placing a green background over the entire isscript section? Can I remove this?

https://www.dropbox.com/s/aefyfpnwuwijtpo/webstorm64_2017-10-10_10-25-11.png?dl=0

0

This background color is used for language injections.

You can change the background color in Settings | Editor | Color Scheme | General | Code | Injected language fragment

1
Avatar
Permanently deleted user

Thanks a ton. There's SO much to know about these IDE's

0
Avatar
Permanently deleted user

This is bizzare, but I remember fixes this a while back - I recently updated my webstorm and now the issue is back. However, I've looked through all of the same settings as previously and its all still there.. Would an update have broken this?

0
Avatar
Permanently deleted user

Actually, scratch that - I ran the invalidate caches and restart and its ok again.

0
Avatar
Permanently deleted user

I have noticed that if I have the characters '</' in a variable string, it completely breaks the formatting on this though. really really sucks can anyone fix this?

0

Please can you provide a code snippet? what's wrong with formatting?

0
Avatar
Permanently deleted user

I think a screenshot would make the most sense in this case

0
Avatar
Permanently deleted user

this is how its formatting my script which is supposed to be javascript. If i put this same code in a normal <script> tag it works perfectly. There is definitely something goin' on

0

problem is caused by HTML injection within the custom injection; formatting is broken in such cases.

Please follow https://youtrack.jetbrains.com/issue/WEB-32048 for updates

0

Please sign in to leave a comment.