FIXED: Bug with Emmet - v10.90b2

Post bug reports when testing beta versions here.
Post Reply
crtrubshaw
Posts: 322
Joined: 06 Jun 2012 11:08

FIXED: Bug with Emmet - v10.90b2

Post by crtrubshaw »

I have taken this example off the emmet.io demo video, if I type the text and choose "Expand Abbreviation at Cursor" (shift + enter) it gives the following error, however if I choose "Expand Abbreviation" (ctrl + ,) and type the text in there, it works fine. It seems to be an issue when there is a space between the curly braces, if I remove the space and choose "Expand Abbreviation at Cursor" (shift + enter), then it works.

ul#nav>li.item$*4>a{Item $}
ExpandAbbreviationAtCursor.jpg
ExpandAbbreviationAtCursor.jpg (203.86 KiB) Viewed 13505 times
User avatar
Rickard Johansson
Site Admin
Posts: 6625
Joined: 19 Jul 2006 14:29

Re: Bug with Emmet - v10.90b2

Post by Rickard Johansson »

Extracting abbreviations at cursor position is not simple, but it should work now. It handles (...), [...], {...} properly now and use regex to distinguish between > in abbreviations and > in legal tags.
crtrubshaw
Posts: 322
Joined: 06 Jun 2012 11:08

Re: FIXED: Bug with Emmet - v10.90b2

Post by crtrubshaw »

There is still a bug with these functions, if I use the example string "html>head+body", if I type the text and choose "Expand Abbreviation at Cursor" (shift + enter) it appears incorrectly [screenshot attached], however it works fine when using "Expand Abbreviation" (ctrl + ,)
ExpandAbbreviationAtCursor.jpg
ExpandAbbreviationAtCursor.jpg (15.23 KiB) Viewed 13475 times
User avatar
Rickard Johansson
Site Admin
Posts: 6625
Joined: 19 Jul 2006 14:29

Re: FIXED: Bug with Emmet - v10.90b2

Post by Rickard Johansson »

This code is taken from the Emmet source code

Code: Select all

function isAllowedChar(ach: Char): Boolean;
var
  charCode: Integer;
  specialChars: string;
begin
  specialChars := '#.*:$-_!@|%';
  charCode := Integer(ach);
  Result := ((charCode > 64) and (charCode < 91)) or      // uppercase letter
                ((charCode > 96) and (charCode < 123)) or    // lowercase letter
                ((charCode > 47) and (charCode < 58) ) or     // number
                (Pos(ach,specialChars) > 0);                         // special character
end;
Adding a + to the specialChars string solves the issue (specialChars := '#.*:$-_!@|%+').

Looking at the code - do you see any other characters that should be allowed in an abbreviation?
User avatar
Rickard Johansson
Site Admin
Posts: 6625
Joined: 19 Jul 2006 14:29

Re: FIXED: Bug with Emmet - v10.90b2

Post by Rickard Johansson »

And I should probably mention that braces like (),[] and {} are already allowed, but tested separately.
crtrubshaw
Posts: 322
Joined: 06 Jun 2012 11:08

Re: FIXED: Bug with Emmet - v10.90b2

Post by crtrubshaw »

This seems to be broken again in v10.90 final.
Post Reply