Skip to content

fix: Restrict Emmet commands to Emmet-supported languages only#302487

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-emmet-toggle-comment-issue
Draft

fix: Restrict Emmet commands to Emmet-supported languages only#302487
Copilot wants to merge 2 commits intomainfrom
copilot/fix-emmet-toggle-comment-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

Emmet commands (e.g. editor.emmet.action.toggleComment) were executing on arbitrary file types like Java, applying HTML/CSS comment syntax where it doesn't belong.

Changes

  • extensions/emmet/src/util.tsvalidate(): Added an Emmet language check using the existing getEmmetMode() infrastructure. Commands now bail out early for unsupported languages.
const mappedModes = getMappingForIncludedLanguages();
const excludedLanguages = vscode.workspace.getConfiguration('emmet').get<string[]>('excludeLanguages') ?? [];
if (!getEmmetMode(editor.document.languageId, mappedModes, excludedLanguages)) {
    return false;
}

Since all Emmet actions call validate() at entry, this single change gates all commands. emmet.includeLanguages and emmet.excludeLanguages user settings are respected.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI linked an issue Mar 17, 2026 that may be closed by this pull request
Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix emmet action toggle comment bug fix: Restrict Emmet commands to Emmet-supported languages only Mar 17, 2026
Copilot AI requested a review from rzhao271 March 17, 2026 17:02
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.

editor.emmet.action.toggleComment

2 participants