diff --git a/extensions/emmet/src/abbreviationActions.ts b/extensions/emmet/src/abbreviationActions.ts index b877ac0f468..4daf647fad0 100644 --- a/extensions/emmet/src/abbreviationActions.ts +++ b/extensions/emmet/src/abbreviationActions.ts @@ -230,7 +230,7 @@ function getSyntaxFromArgs(args: any): string { const mappedModes = getMappingForIncludedLanguages(); let language: string = (!args || typeof args !== 'object' || !args['language']) ? editor.document.languageId : args['language']; let parentMode: string = (args && typeof args === 'object') ? args['parentMode'] : undefined; - let excludedLanguages = vscode.workspace.getConfiguration('emmet')['exlcudeLanguages'] ? vscode.workspace.getConfiguration('emmet')['exlcudeLanguages'] : []; + let excludedLanguages = vscode.workspace.getConfiguration('emmet')['excludeLanguages'] ? vscode.workspace.getConfiguration('emmet')['excludeLanguages'] : []; let syntax = getEmmetMode((mappedModes[language] ? mappedModes[language] : language), excludedLanguages); if (syntax) { return syntax; diff --git a/extensions/emmet/src/defaultCompletionProvider.ts b/extensions/emmet/src/defaultCompletionProvider.ts index e959d4730b1..7fd535a3418 100644 --- a/extensions/emmet/src/defaultCompletionProvider.ts +++ b/extensions/emmet/src/defaultCompletionProvider.ts @@ -16,7 +16,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi const emmetConfig = vscode.workspace.getConfiguration('emmet'); let isSyntaxMapped = mappedLanguages[document.languageId] ? true : false; - let excludedLanguages = emmetConfig['exlcudeLanguages'] ? emmetConfig['exlcudeLanguages'] : []; + let excludedLanguages = emmetConfig['excludeLanguages'] ? emmetConfig['excludeLanguages'] : []; let syntax = getEmmetMode((isSyntaxMapped ? mappedLanguages[document.languageId] : document.languageId), excludedLanguages); if (document.languageId === 'html' || isStyleSheet(document.languageId)) { diff --git a/extensions/emmet/src/test/abbreviationAction.test.ts b/extensions/emmet/src/test/abbreviationAction.test.ts index f997e5b2a52..653e9499f4b 100644 --- a/extensions/emmet/src/test/abbreviationAction.test.ts +++ b/extensions/emmet/src/test/abbreviationAction.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { Selection } from 'vscode'; +import { Selection, workspace } from 'vscode'; import { withRandomFileEditor, closeAllEditors } from './testUtils'; import { expandAbbreviation, wrapWithAbbreviation } from '../abbreviationActions'; @@ -88,7 +88,10 @@ const wrapMultiLineAbbrExpected = ` `; suite('Tests for Expand Abbreviations (HTML)', () => { - teardown(closeAllEditors); + teardown(() => { + // Reset config and close all editors + return workspace.getConfiguration('emmet').update('excludeLanguages', []).then(closeAllEditors); + }); test('Expand snippets (HTML)', () => { return testHtmlExpandAbbreviation(new Selection(3, 23, 3, 23), 'img', '\"\"'); @@ -135,6 +138,15 @@ suite('Tests for Expand Abbreviations (HTML)', () => { }); }); }); + + test('No expanding when html is excluded in the settings', () => { + return workspace.getConfiguration('emmet').update('excludeLanguages', ['html']).then(() => { + return testHtmlExpandAbbreviation(new Selection(9, 6, 9, 6), '', '', true).then(() => { + return workspace.getConfiguration('emmet').update('excludeLanguages', []); + }); + }); + }); + }); suite('Tests for Expand Abbreviations (CSS)', () => { @@ -213,7 +225,6 @@ suite('Tests for Wrap with Abbreviations', () => { function testHtmlExpandAbbreviation(selection: Selection, abbreviation: string, expandedText: string, shouldFail?: boolean): Thenable { - return withRandomFileEditor(htmlContents, 'html', (editor, doc) => { editor.selection = selection; let expandPromise = expandAbbreviation(null);