Treat inline elements as block when wrapping with abbr Fixes #29898

This commit is contained in:
Ramya Achutha Rao 2017-07-22 18:21:02 -07:00
parent 2932125ae3
commit dac7e15aba

View file

@ -44,7 +44,7 @@ export function wrapWithAbbreviation(args) {
let textToWrap = '';
let preceedingWhiteSpace = '';
if (whitespaceBeforeSelection && !rangeToReplace.isSingleLine) {
if (whitespaceBeforeSelection) {
const matches = firstLine.match(/^(\s*)/);
if (matches) {
preceedingWhiteSpace = matches[1];
@ -218,6 +218,13 @@ function expandAbbreviationInRange(editor: vscode.TextEditor, expandAbbrList: Ex
function expandAbbr(input: ExpandAbbreviationInput, newLine: string): string {
const emmetConfig = vscode.workspace.getConfiguration('emmet');
const expandOptions = getExpandOptions(emmetConfig['syntaxProfiles'], emmetConfig['variables'], input.syntax, input.textToWrap);
if (input.textToWrap) {
// Below fixes https://github.com/Microsoft/vscode/issues/29898
// With below, Emmet formats inline elements as block elements
// ensuring the wrapped text does not get merged to a single line
expandOptions.profile['inlineBreak'] = 1;
}
// Expand the abbreviation
let expandedText;
try {