-
Notifications
You must be signed in to change notification settings - Fork 57
Conversation
After using this for myself for some time I discovered a usability problem with the JSTL Tag Snippets:
For example
<c:if<tab>
results in
<c:<c:if test="${true}">
</c:if>
because if is a snippet prefix.
I don't know what would be a good alternative... Maybe <c:if instead of if, but that's pretty verbose.
Or is it possible to use a regex like (?:^|[^:])if as prefix?
The closing tag was not closing.
MoritzKn
commented
Oct 13, 2016
I figured it would be nice if "tag snippets" would only work outside of tags. So that this:
<div out[tab]> </div>
wouldn't result in this:
<div <c:out value="${}"/>> </div>
winstliu
commented
Oct 13, 2016
Hmm. c:if should definitely take priority over just if. I wonder where that matching occurs.
MoritzKn
commented
Oct 15, 2016
@50Wliu I've done some research on that <c:if vs if problem:
The snippets package does -- probably for performance reasons -- some complicated stuff, but basically it just checks if the text behind the cursor is equal to the prefix of a snippet in scope and if that's the case, it replaces the prefix with the snippet text.
Now I could do two things:
- Add a second version of each "tag snippets" whose prefix starts with
<c: - Add a second version of each "tag snippets" with out any prefix. That's what the language-html package has done. This will remove the snippets inside tags.
I prefer the first method, but I don't like that this means I have to duplicate all the code.
Pressing tab after `<c:if` previously produced `<c:<c:if...`.
MoritzKn
commented
Oct 16, 2016
I fixed this problem in the last commit. It's not perfect because it adds some redundancy, but I think it's the best we can get. Correct me if I'm wrong.
See: JSP Syntax on Tutorialspoint and JSP - Standard Tag Library on Tutorialspoint