Skip to content

Commit 253f13a

Browse files
gushuroramya-rao-a
authored andcommitted
fixing bug in tabstop numbering (#18)
1 parent e9f834b commit 253f13a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/emmetHelper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ function addFinalTabStop(text): string {
292292
}
293293

294294
// Decide to replace currentTabStop with ${0} only if its the max among all tabstops and is not a placeholder
295-
if (currentTabStop > maxTabStop) {
295+
if (Number(currentTabStop) > Number(maxTabStop)) {
296296
maxTabStop = currentTabStop;
297297
maxTabStopRanges = [{ numberStart, numberEnd }];
298298
replaceWithLastStop = !foundPlaceholder;

src/test/emmetHelperTest.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ describe('Test completions', () => {
417417
['<div>u-l-z</div>', 0, 10, 'u-l-z', '<u-l-z>|</u-l-z>', '<u-l-z>\${0}</u-l-z>'], // Word with - is valid
418418
[bemFilterExampleWithInlineFilter, 0, bemFilterExampleWithInlineFilter.length, bemFilterExampleWithInlineFilter, expectedBemFilterOutputDocs, expectedBemFilterOutput],
419419
[commentFilterExampleWithInlineFilter, 0, commentFilterExampleWithInlineFilter.length, commentFilterExampleWithInlineFilter, expectedCommentFilterOutputDocs, expectedCommentFilterOutput],
420-
['li*2+link:css', 0, 13, 'li*2+link:css', '<li>|</li>\n<li>|</li>\n<link rel="stylesheet" href="style.css">', '<li>\${1}</li>\n<li>\${2}</li>\n<link rel="stylesheet" href="\${4:style}.css">'] // No last tab stop gets added as max tab stop is of a placeholder
420+
['li*2+link:css', 0, 13, 'li*2+link:css', '<li>|</li>\n<li>|</li>\n<link rel="stylesheet" href="style.css">', '<li>\${1}</li>\n<li>\${2}</li>\n<link rel="stylesheet" href="\${4:style}.css">'], // No last tab stop gets added as max tab stop is of a placeholder
421+
['li*10', 0, 5, 'li*10', '<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>\n<li>|</li>',
422+
'<li>\${1}</li>\n<li>\${2}</li>\n<li>\${3}</li>\n<li>\${4}</li>\n<li>\${5}</li>\n<li>\${6}</li>\n<li>\${7}</li>\n<li>\${8}</li>\n<li>\${9}</li>\n<li>\${0}</li>'], // tabstop 10 es greater than 9, should be replaced by 0
423+
421424
];
422425

423426
testCases.forEach(([content, positionLine, positionChar, expectedAbbr, expectedExpansionDocs, expectedExpansion]) => {

0 commit comments

Comments
 (0)