Skip to content

Commit

Permalink
Support expansion of commonly used html tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jul 20, 2017
1 parent 781bf99 commit d230b55
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/emmetHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const htmlAbbreviationStartRegex = /^[a-z,A-Z,!,(,[,#,\.]/;
const htmlAbbreviationEndRegex = /[a-z,A-Z,!,),\],#,\.,},\d,*,$]$/;
const cssAbbreviationRegex = /^[a-z,A-Z,!,@,#]/;
const emmetModes = ['html', 'pug', 'slim', 'haml', 'xml', 'xsl', 'jsx', 'css', 'scss', 'sass', 'less', 'stylus'];
const commonlyUsedTags = ['div', 'span', 'p', 'b', 'i', 'body', 'html', 'ul', 'ol', 'li', 'head', 'script'];

export interface EmmetConfiguration {
useNewEmmet: string;
Expand Down Expand Up @@ -46,7 +47,7 @@ export function doComplete(document: TextDocument, position: Position, syntax: s
if (isAbbreviationValid(syntax, abbreviation)) {
let expandedText;
// Skip cases where abc -> <abc>${1}</abc> as this is noise
if (isStyleSheet(syntax) || !/^[a-z,A-Z]*$/.test(abbreviation) || htmlSnippetKeys.indexOf(abbreviation) > -1) {
if (isStyleSheet(syntax) || !/^[a-z,A-Z]*$/.test(abbreviation) || htmlSnippetKeys.indexOf(abbreviation) > -1 || commonlyUsedTags.indexOf(abbreviation) > -1) {
try {
expandedText = expand(abbreviation, expandOptions);
// Skip cases when abc -> abc: ; as this is noise
Expand Down

0 comments on commit d230b55

Please sign in to comment.