Skip to content

Commit

Permalink
feat(emmet): add mappedModes option
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Apr 30, 2024
1 parent cd3360b commit 2010ef2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/emmet/index.ts
Expand Up @@ -24,7 +24,11 @@ function getHtmlDocument(document: TextDocument) {
return doc;
}

export function create(): LanguageServicePlugin {
export function create({
mappedModes = {},
}: {
mappedModes?: Record<string, string>;
}): LanguageServicePlugin {
return {
name: 'emmet',
// https://docs.emmet.io/abbreviations/syntax/
Expand All @@ -37,7 +41,7 @@ export function create(): LanguageServicePlugin {

async provideCompletionItems(textDocument, position) {

const syntax = emmet.getEmmetMode(textDocument.languageId === 'vue' ? 'html' : textDocument.languageId);
const syntax = emmet.getEmmetMode(mappedModes[textDocument.languageId] ?? textDocument.languageId);
if (!syntax) {
return;
}
Expand Down

0 comments on commit 2010ef2

Please sign in to comment.