diff --git a/extensions/emmet/src/abbreviationActions.ts b/extensions/emmet/src/abbreviationActions.ts index 23cb3185c25..f6634d35c9c 100644 --- a/extensions/emmet/src/abbreviationActions.ts +++ b/extensions/emmet/src/abbreviationActions.ts @@ -614,7 +614,7 @@ function expandAbbr(input: ExpandAbbreviationInput): string { } // If wrapping with a block element, insert newline in the text to wrap. - if (wrappingNode && inlineElements.indexOf(wrappingNode.name) === -1) { + if (wrappingNode && inlineElements.indexOf(wrappingNode.name) === -1 && (expandOptions['profile'].hasOwnProperty('format') ? expandOptions['profile'].format : true)) { wrappingNode.value = '\n\t' + wrappingNode.value + '\n'; } } diff --git a/extensions/emmet/src/test/wrapWithAbbreviation.test.ts b/extensions/emmet/src/test/wrapWithAbbreviation.test.ts index 6e2bf273f92..910f6ef0dba 100644 --- a/extensions/emmet/src/test/wrapWithAbbreviation.test.ts +++ b/extensions/emmet/src/test/wrapWithAbbreviation.test.ts @@ -5,7 +5,7 @@ import 'mocha'; import * as assert from 'assert'; -import { Selection } from 'vscode'; +import { Selection, workspace, ConfigurationTarget } from 'vscode'; import { withRandomFileEditor, closeAllEditors } from './testUtils'; import { wrapWithAbbreviation, wrapIndividualLinesWithAbbreviation } from '../abbreviationActions'; @@ -56,6 +56,13 @@ const wrapMultiLineAbbrExpected = ` `; +const wrapInlineElementExpectedFormatFalse = ` + +`; + suite('Tests for Wrap with Abbreviations', () => { teardown(closeAllEditors); @@ -63,6 +70,7 @@ suite('Tests for Wrap with Abbreviations', () => { const multiCursorsWithSelection = [new Selection(2, 2, 2, 28), new Selection(3, 2, 3, 33)]; const multiCursorsWithFullLineSelection = [new Selection(2, 0, 2, 28), new Selection(3, 0, 4, 0)]; + const oldValueForSyntaxProfiles = workspace.getConfiguration('emmet').inspect('syntaxProfile'); test('Wrap with block element using multi cursor', () => { return testWrapWithAbbreviation(multiCursors, 'div', wrapBlockElementExpected); @@ -340,6 +348,14 @@ suite('Tests for Wrap with Abbreviations', () => { }); }); }); + + test('Wrap individual lines with abbreviation and format set to false', () => { + return workspace.getConfiguration('emmet').update('syntaxProfiles',{ 'html' : { 'format': false } } , ConfigurationTarget.Global).then(() => { + return testWrapWithAbbreviation(multiCursors,'h1',wrapInlineElementExpectedFormatFalse).then(() => { + return workspace.getConfiguration('emmet').update('syntaxProfiles',oldValueForSyntaxProfiles ? oldValueForSyntaxProfiles.globalValue : undefined, ConfigurationTarget.Global); + }); + }); + }); });