aronwoost/sublime-expand-region

Bug: tag selection not working properly in HTML (.php)

Closed this issue · 5 comments

When trying to select the tag with ExpandRegion, the selection doesn't select the tag but instead selects either the next attribute, the next bracket or the end tag.

Test case 1:
Region expansion (selection shown as [], cursor in test):

  1. <div class="[test]"></div>
  2. <div class=["test"]></div>
  3. <div class=["test"></div>]
  4. End

Test case 2:

  1. <div class="[test]" id="test"></div>
  2. ...
  3. <div class=["test" id]="test"></div>
  4. End

Test case 3:

<div class="[test]">
</div>
2)
<div class=["test"]>
</div>
3)
<div class=["test">]
</div>
4) End

PS: Shouldn't it select the entire attribute first, before selecting the tag?
Like: <div [class="test]"></div>

EDIT: It just isn't working in *.php files, that's why. Don't know if this can be aided?

What file extension does the file you're working on have? Please try to replicate the test cases in a file called something.html.

Well, as the edit suggested, it works perfectly in an html file.

But often I am working in an html file that contains bits of php, in that case the file is renamed to something.php instead of something.html although it's HTML for the most part.

I can only use the file extension to determine which expand strategy to choose. And php certainly needs to be treated differently then html. I'll think about making it possible to override this in some kind of settings.

Does this make sense?

Yeah, that would be greatly appreciated, thanks Aron.

Closing it for now.