This week, I managed to get my Emmet PR done. After 3 weeks I made major progress on Emmet.
Emmet
To recap, in my first week I built Emmet CSS Parser and figured out that stringScore is the primary method for ranking abbreviations. I then changed the method signature so that it included the full string abbreviations. For my second week, I changed the method so that if it could not match all of the characters in the abbreviation then it compared against the full string.
After some testing, I managed to narrow down to 4 tests that were failing after my changes.
The two tests I wanted to investigate were to from the resolve.js
.
The following tests failed:
it('case insensitive matches', () => {
assert.equal(expand('trf:rx'), 'transform: rotateX(${1:angle});');
});
assert.equal(expand('scx', { property: 'transform' }), 'scaleX(${1:x})');
After debugging, Emmet pumped out these numbers:
Rotate – 0.14
RotateX – 0.12
RotateY – 0.12
RotateZ – 0.12
A common theme in the failing tests were the X or Y. I needed to figure out why rotateX
is rated low. Another change I noticed was that string
was equal to rotatex
and fullString
was equal to rotateX
. I realized that my ranking was lower because it couldn’t match X against abbr’s x. I then added .toLowerCase()
to fix the issue.
The other two tests were in score.js
. After some debugging, it had to do with how score.js
used stringScore
. It needed to be updated to include the new argument I had added. I had to modify it to this: score(abbr, item, item)
.
After I fixed that problem, it passed all the tests.
I finally implemented the maintainer’s suggestion and submitted a PR for it.
In the next coming weeks, I plan on making my next long term goal to be tackling a Typescript Bug.