Skip to content

feat: support one-to-many language mapping in emmet.includeLanguages - #331033

Open
Genius740Code wants to merge 2 commits into
microsoft:mainfrom
Genius740Code:feature/emmet-one-to-many-languages
Open

feat: support one-to-many language mapping in emmet.includeLanguages#331033
Genius740Code wants to merge 2 commits into
microsoft:mainfrom
Genius740Code:feature/emmet-one-to-many-languages

Conversation

@Genius740Code

Copy link
Copy Markdown

Adds support for mapping a single file extension to multiple Emmet languages via array syntax in emmet.includeLanguages configuration. For example: emmet.includeLanguages: { tt: [html, css, javascript] }

Changes:

  • Update package.json schema to accept both string and array values
  • Modify getMappingForIncludedLanguages() to handle array mappings
  • Update completion provider registration to merge trigger characters from multiple languages
  • Enhance completion provider logic to try multiple languages when using array mappings
  • Update abbreviation actions to handle array mappings
  • Add comprehensive test coverage for new functionality
  • Maintain full backward compatibility with existing string-based configurations

Fixes #62910

Adds support for mapping a single file extension to multiple Emmet languages
via array syntax in emmet.includeLanguages configuration. For example:
emmet.includeLanguages: { tt: [html, css, javascript] }

Changes:
- Update package.json schema to accept both string and array values
- Modify getMappingForIncludedLanguages() to handle array mappings
- Update completion provider registration to merge trigger characters from multiple languages
- Enhance completion provider logic to try multiple languages when using array mappings
- Update abbreviation actions to handle array mappings
- Add comprehensive test coverage for new functionality
- Maintain full backward compatibility with existing string-based configurations

Fixes microsoft#62910
Copilot AI balanced review requested due to automatic review settings August 15, 2026 17:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for one-to-many emmet.includeLanguages mappings (string or string[]) so Emmet can resolve multiple candidate modes (e.g., HTML + CSS) for a single language and merge completion trigger characters accordingly.

Changes:

  • Extend emmet.includeLanguages setting schema and mapping utilities to accept string | string[].
  • Update completion / abbreviation resolution logic to try multiple mapped languages in order and merge trigger characters.
  • Add/extend tests covering array mappings, filtering invalid entries, and backward compatibility.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
extensions/emmet/src/util.ts Broadens mapping + mode resolution types to support array mappings.
extensions/emmet/src/test/util.test.ts New tests for getMappingForIncludedLanguages including array filtering behavior.
extensions/emmet/src/test/completion.test.ts Adds completion-provider tests for array mappings (HTML/CSS), invalid entries, and empty arrays.
extensions/emmet/src/test/abbreviationAction.test.ts Adds expansion/completion tests for array mapping behavior in script-tag contexts.
extensions/emmet/src/emmetCommon.ts Updates provider registration logic to handle array mappings and merge trigger characters.
extensions/emmet/src/defaultCompletionProvider.ts Tries multiple mapped languages when determining Emmet mode.
extensions/emmet/src/abbreviationActions.ts Extends syntax resolution from args to support array mappings for language/parentMode.
extensions/emmet/package.json Updates config schema to allow emmet.includeLanguages values to be string or string[].

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread extensions/emmet/src/test/util.test.ts Outdated
Comment on lines +13 to +16
test('Should return empty object when no config is set', () => {
const mapping = getMappingForIncludedLanguages();
assert.ok(mapping);
assert.strictEqual(Object.keys(mapping).length, 0);
Comment thread extensions/emmet/src/test/abbreviationAction.test.ts
Comment on lines 195 to 196
clearCompletionProviderInfo();

Comment thread extensions/emmet/src/emmetCommon.ts Outdated
Comment on lines 230 to 232
if (languageMappingForCompletionProviders.has(language) && areMappingsEqual(languageMappingForCompletionProviders.get(language)!, mapping)) {
return;
}
- Add proper config isolation in util.test.ts by explicitly setting includeLanguages to undefined and restoring original config in finally block
- Remove dead areMappingsEqual function and its ineffective usage in refreshCompletionProviders since clearCompletionProviderInfo() clears the map before the equality check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emmet.includeLanguages for one to many mapping

3 participants