Skip to content

[Bug] HTML language does not recognize inline <script type="module"> as JavaScript #2962

Open

Description

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Code

monaco.editor.create(document.getElementById('container'), {
	value: `<script type="module">\n\tconsole.log("hello");\n</script>`,
	language: 'html'
});

Actual Behavior

The contents of the script tag are marked as language vs.editor.nullLanguage, precluding highlighting and, upon editing or merely moving the cursor within the tag, causing various callbacks for editor features to throw Unexpected languageId when calling LanguageConfigurationRegistry.getLanguageConfiguration.

Expected Behavior

Inline code is recognized as JavaScript, is syntax highlighted, and editing/navigation does not raise exceptions.

Additional Context

This began causing exceptions in version 0.32.0, with 0.31.1 and prior nothing is raised but the inline code is still similarly marked as vs.editor.nullMode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions