Home Download Buy Blog Forum Support

Autocompletes adding extra opening tag

Autocompletes adding extra opening tag

Postby handycam on Sat Jan 21, 2012 5:02 pm

I just noticed today, on an html file, if I type a <, then "tr" (for example) and choose the "tr" in the autocomplete suggestion popup, I get

Code: Select all
<<tr></tr>


Which is, of course, wrong. The extra < is flagged as incorrect.
This is now happening on all html tags; p, td, etc.
Why is this happening?
Mac OS 10.9.3
ST 3 (3059)
handycam
 
Posts: 271
Joined: Tue Jan 03, 2012 2:42 pm

Re: Autocompletes adding extra opening tag

Postby purewise on Mon Jan 23, 2012 5:03 pm

Handycam, what I noticed is that when I uninstalled Zen Code, I didn't have that issue any longer.

Another issue I've noticed is that when I do the shortcut "li,tab" to create a list item, it expands to <li></li> (with a highlighted anchor element inside which is pretty cool) but also creates an "li" on the next line. THis is quite annoying because now I have to delete the extra "li"
purewise
 
Posts: 1
Joined: Mon Jan 23, 2012 5:00 pm

Re: Autocompletes adding extra opening tag

Postby jabyuk on Tue Feb 14, 2012 10:45 pm

I have also noticed both of the behaviours mentioned:

I just noticed today, on an html file, if I type a <, then "tr" (for example) and choose the "tr" in the autocomplete suggestion popup, I get <<tr></tr>


I've noticed is that when I do the shortcut "li,tab" to create a list item, it expands to <li></li> (with a highlighted anchor element inside which is pretty cool) but also creates an "li" on the next line.


I agree with Purewise that the first issue is being caused by the "Zen Coding" plugin. When I remove it this problem disappears.

In my experience the second issue is being caused by the "HTML5" plugin. Removing this also corrects this problem of the extra "li" on the next line (but leaves me without the benefits of the plugin).

Hopefully both the "Zen Coding" and "HTML5" plugins will have these issues corrected as both are otherwise really great.
jabyuk
 
Posts: 4
Joined: Tue Feb 14, 2012 10:36 pm

Re: Autocompletes adding extra opening tag

Postby sublimator on Tue Feb 14, 2012 11:48 pm

handycam wrote:I just noticed today, on an html file, if I type a <, then "tr" (for example) and choose the "tr" in the autocomplete suggestion popup, I get

Code: Select all
<<tr></tr>


Which is, of course, wrong. The extra < is flagged as incorrect.
This is now happening on all html tags; p, td, etc.
Why is this happening?


Seems to be an artifact of the builtin setting to use `<` to trigger the auto-completion dialogue:
// Additional situations to trigger auto complete
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],

There's a builtin plugin to auto complete tags which Zen has always disabled. Note it doesn't insert the `<`
return ([
(
"a\tTag", "a href=\"$1\">$2</a>"),
(
"abbr\tTag", "abbr>$1</abbr>"),
(
"acronym\tTag", "acronym>$1</acronym>"),
(
"address\tTag", "address>$1</address>"),


Zen does a reverse scan on the current line to find the current abbreviation which is was gets replaced by the full expansion.

Zen will need to be patched to be aware of that change to Sublime.

I've personally just changed my `auto_complete_selector` to show all the time, though my version of Zen is a bit ahead of what's published. The old version, I think, has bugs that will surely litter the console with error messages. I started preparing a new release a week or so back but have since been distracted by work.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: Autocompletes adding extra opening tag

Postby jabyuk on Thu Feb 16, 2012 10:39 pm

castles_made_of_sand wrote:
handycam wrote:I just noticed today, on an html file, if I type a <, then "tr" (for example) and choose the "tr" in the autocomplete suggestion popup, I get

Code: Select all
<<tr></tr>


Which is, of course, wrong. The extra < is flagged as incorrect.
This is now happening on all html tags; p, td, etc.
Why is this happening?


Seems to be an artifact of the builtin setting to use `<` to trigger the auto-completion dialogue:
// Additional situations to trigger auto complete
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],

There's a builtin plugin to auto complete tags which Zen has always disabled. Note it doesn't insert the `<`
return ([
(
"a\tTag", "a href=\"$1\">$2</a>"),
(
"abbr\tTag", "abbr>$1</abbr>"),
(
"acronym\tTag", "acronym>$1</acronym>"),
(
"address\tTag", "address>$1</address>"),


Zen does a reverse scan on the current line to find the current abbreviation which is was gets replaced by the full expansion.

Zen will need to be patched to be aware of that change to Sublime.

I've personally just changed my `auto_complete_selector` to show all the time, though my version of Zen is a bit ahead of what's published. The old version, I think, has bugs that will surely litter the console with error messages. I started preparing a new release a week or so back but have since been distracted by work.


It would be really great if a future release could resolve this problem.

Otherwise the Zen coding plugin is really great and I am very grateful that you set aside your own time to create and maintain it. Many thanks.
jabyuk
 
Posts: 4
Joined: Tue Feb 14, 2012 10:36 pm

Re: Autocompletes adding extra opening tag

Postby kabadesu on Thu Mar 01, 2012 9:43 pm

I thought this fixed in OSX, but I was wrong.
kabadesu
 
Posts: 31
Joined: Wed Feb 29, 2012 9:28 am

Re: Autocompletes adding extra opening tag

Postby peruvianidol on Tue Jun 26, 2012 6:03 pm

I was having the same issue. Went into Packages/HTML/html_completions.py (ln 52) and removed the opening bracket from the following lines and it cleared up the issue. Hope this helps!

Code: Select all
        if op == '.':
            snippet = "<{0} class=\"{1}\">$1</{0}>$0".format(tag, arg)
        else:
            snippet = "<{0} id=\"{1}\">$1</{0}>$0".format(tag, arg)
peruvianidol
 
Posts: 1
Joined: Tue Jun 26, 2012 6:00 pm

Re: Autocompletes adding extra opening tag

Postby gushot on Tue Aug 21, 2012 10:09 pm

I've created an Issue on Sublimator's github repo https://github.com/sublimator/ZenCoding/issues/8 about this, as I didn't see any mention of it.
gushot
 
Posts: 6
Joined: Wed Aug 01, 2012 12:25 am

Re: Autocompletes adding extra opening tag

Postby jenstechs on Thu Sep 13, 2012 5:48 pm

Thanks peruvianidol, but that doesn't seem to solve my problem. I deleted the < on those two lines but it still auto-completes with it in there. Any other places I should change code?
jenstechs
 
Posts: 1
Joined: Thu Sep 13, 2012 5:44 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests