Use jsx transformations in emmet
This commit is contained in:
parent
d4bbcc6368
commit
02783b149c
2 changed files with 10 additions and 6 deletions
|
@ -20,11 +20,13 @@ export function wrapWithAbbreviation() {
|
|||
rangeToReplace = new vscode.Range(rangeToReplace.start.line, 0, rangeToReplace.start.line, editor.document.lineAt(rangeToReplace.start.line).text.length);
|
||||
}
|
||||
let textToReplace = editor.document.getText(rangeToReplace);
|
||||
let syntax = getSyntax(editor.document);
|
||||
let options = {
|
||||
field: field,
|
||||
syntax: getSyntax(editor.document),
|
||||
syntax: syntax,
|
||||
profile: getProfile(getSyntax(editor.document)),
|
||||
text: textToReplace
|
||||
text: textToReplace,
|
||||
addons: syntax === 'jsx' ? { 'jsx': syntax === 'jsx' } : null
|
||||
};
|
||||
|
||||
vscode.window.showInputBox({ prompt: 'Enter Abbreviation' }).then(abbr => {
|
||||
|
@ -45,11 +47,12 @@ export function expandAbbreviation() {
|
|||
if (rangeToReplace.isEmpty) {
|
||||
[rangeToReplace, abbr] = extractAbbreviation(rangeToReplace.start);
|
||||
}
|
||||
|
||||
let syntax = getSyntax(editor.document);
|
||||
let options = {
|
||||
field: field,
|
||||
syntax: getSyntax(editor.document),
|
||||
profile: getProfile(getSyntax(editor.document))
|
||||
syntax: syntax,
|
||||
profile: getProfile(getSyntax(editor.document)),
|
||||
addons: syntax === 'jsx' ? { 'jsx': true } : null
|
||||
};
|
||||
|
||||
let expandedText = expand(abbr, options);
|
||||
|
|
|
@ -40,7 +40,8 @@ function getExpandedAbbreviation(document: vscode.TextDocument, position: vscode
|
|||
let expandedWord = expand(wordToExpand, {
|
||||
field: field,
|
||||
syntax: syntax,
|
||||
profile: getProfile(syntax)
|
||||
profile: getProfile(syntax),
|
||||
addons: syntax === 'jsx' ? { 'jsx': true } : null
|
||||
});
|
||||
|
||||
let completionitem = new vscode.CompletionItem(wordToExpand);
|
||||
|
|
Loading…
Reference in a new issue