Skip to content

Commit

Permalink
Case sensitive check for noise
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Aug 24, 2017
1 parent 3d76f38 commit 1359d5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/emmetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function isExpandedTextNoise(syntax: string, abbreviation: string, expandedText:
return expandedText === `${abbreviation}: \${1};`
}

if (commonlyUsedTags.indexOf(abbreviation) > -1 || markupSnippetKeys.indexOf(abbreviation) > -1) {
if (commonlyUsedTags.indexOf(abbreviation.toLowerCase()) > -1 || markupSnippetKeys.indexOf(abbreviation) > -1) {
return false;
}

Expand All @@ -329,8 +329,8 @@ function isExpandedTextNoise(syntax: string, abbreviation: string, expandedText:
}

// Unresolved html abbreviations get expanded as if it were a tag
// Eg: abc -> <abc></abc> which is noise if it gets suggested for every word typed
return expandedText === `<${abbreviation}>\${1}</${abbreviation}>`;
// Eg: abc -> <abc></abc> which is noise if it gets suggested for every word typed
return expandedText.toLowerCase() === `<${abbreviation.toLowerCase()}>\${1}</${abbreviation.toLowerCase()}>`;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/test/emmetHelperTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ describe('Test completions', () => {
return updateExtensionsPath(null).then(() => {
const testCases: [string, number, number, string, string][] = [
['<div>ul>li*3</div>', 0, 7, 'ul', '<ul>|</ul>'], // One of the commonly used tags
['<div>UL</div>', 0, 7, 'UL', '<UL>|</UL>'], // One of the commonly used tags with upper case
['<div>ul>li*3</div>', 0, 10, 'ul>li', '<ul>\n\t<li>|</li>\n</ul>'], // Valid abbreviation
['<div>(ul>li)*3</div>', 0, 14, '(ul>li)*3', '<ul>\n\t<li>|</li>\n</ul>\n<ul>\n\t<li>|</li>\n</ul>\n<ul>\n\t<li>|</li>\n</ul>'], //Valid abbreviation with grouping
['<div>custom-tag</div>', 0, 15, 'custom-tag', '<custom-tag>|</custom-tag>'], // custom tag with -
Expand Down Expand Up @@ -381,6 +382,7 @@ describe('Test completions', () => {
return updateExtensionsPath(null).then(() => {
const testCases: [string, number, number][] = [
['<div>abc</div>', 0, 8], // Simple word
['<div>Abc</div>', 0, 8], // Simple word with mixed casing
['<div>abc12</div>', 0, 10], // Simple word with numbers
['<div>abc.</div>', 0, 9], // Word ending with period
['<div>(div)</div>', 0, 10], // Word inside brackets
Expand Down

0 comments on commit 1359d5d

Please sign in to comment.