Sublime Forum

Closing <script> tags with the close-tag functionality

#1

For some reason this doesn’t work. Is there any specific reason for this?

[code]

var foo = 'bar';[/code] If I press alt + . it will close the tag by inserting . Why doesn't it close the script tag?
0 Likes

Closing <script> tags with the close-tag functionality
#2

This issue seems to be present no matter where the script is (i.e. just before the close of the body element).

0 Likes

#3

I understand why it would do this with and tabs - They don’t have closing tags, just like . But does have a closing tag. Is this a bug?

0 Likes

#4

I think this is a problem with HTML.tmLanguage file.

I’ve wanted to know why, in addition to not being able to close those tags, the matching tag decoration won’t work with some tags including script tags.
So, a bump from me. Hopefully someone more knowledgeable chimes in.

EDIT: the tag matching decoration appears to work using meta.tag.blah.html so to fix this issue jps will need to add meta.tag.script.html to the source.js.embedded.html and meta.tag.style.html to the source.css.embedded.html definitions in HTML.tmLanguage

EDIT2: Although this works it will cause the entire block of code within the tags to scope as meta.tag.blah… which will cause problems of it’s own. I believe it may be still possible to match source tags without having to scope the entire thing as a meta.tag block

HTH

0 Likes

#5

Bump - I think this is a bug and no one is really confirming or denying this.

0 Likes

#6

It’s nearly a whole year since the last post on this… I have the very latest version of ST2 installed and it still won’t auto close tags…
Can someone post a clear solution on how to fix this please?
It’s an annoying niggle in an otherwise awesome editor, and it breaks my workflow :frowning:

Cheers

0 Likes

#7

It is quite easy to create a snippet:

[code]
<![CDATA[

$0

]]>

script

text.html.basic
[/code]

There is also a Tag plug-in which might work (haven’t used it myself).

0 Likes

#8

…or this version:

[code]
<![CDATA[

]]>

script

text.html.basic
[/code]

0 Likes