Sublime Forum

Issue with underlining start and closing HTML tag

#1

In some situations I have lot of trouble with ST 3 when I place the cursor on an HTML element (e.g. div) and I expect that ST underlines both

and
elements. This normaly works fine. In the example below in does not work on the first div elements. Interestingly, if I delete some other div elements, it works again. Or if I change the indentation of the whole block of code, it works again. The behavior is somehow reandomly.

When you open this link, press CTRL+U to view the HTML code. Copy/Paste the code to ST 3 and press the cursor on the first div element. It shoult be underlined, but it isn’t. Now delete more and more divs below the first div. Check again, if the fist div is underlined:

www.meshparts.de/download/issue.html

0 Likes

#2

Looks like some kind of sanity limit which causes ST to stop looking for closing tags if it was not found after a certain amount of lines/chars. Those limits exist to guarantee performance and are often hardcoded.

0 Likes

#3

So my exampel code is “not sane”? Why? It’s a normal HTML code.

0 Likes

#4

This might not be a satisfactory answer, but try installing the BracketHighlighter package. You’ll see that it will mark the unresolved tag with a red box and a ? in the gutter. If you hover over this, you’ll get an option in the popup to temporarily disable the limit @deathaxe was referring to, and it will correctly resolve the tag pair.

If this works for you, you can make this change permanent by modifying the package’s search_threshold as documented here: https://facelessuser.github.io/BracketHighlighter/customize/#search_threshold

0 Likes

#5

Thanks for the tip. I set the search_threshold limit to 100000 and it works better but I think there is a bug: In some situations, the brackets only recognized if I place the cursor on the closing element but not on the opening

element. Can someone verify this?
0 Likes

#6

False alarm. No bug there. It was another syntactic error that caused the described behavior.

0 Likes