Page 1 of 1
FIXED: Bug with Emmet - v10.90b2
Posted: 01 Dec 2015 18:12
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 (203.86 KiB) Viewed 14777 times
Re: Bug with Emmet - v10.90b2
Posted: 02 Dec 2015 15:46
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.
Re: FIXED: Bug with Emmet - v10.90b2
Posted: 08 Dec 2015 20:25
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 (15.23 KiB) Viewed 14747 times
Re: FIXED: Bug with Emmet - v10.90b2
Posted: 09 Dec 2015 08:06
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?
Re: FIXED: Bug with Emmet - v10.90b2
Posted: 09 Dec 2015 08:10
by Rickard Johansson
And I should probably mention that braces like (),[] and {} are already allowed, but tested separately.
Re: FIXED: Bug with Emmet - v10.90b2
Posted: 18 Dec 2015 14:41
by crtrubshaw
This seems to be broken again in v10.90 final.