Skip to content

Syntax highlighting for Ember .gjs and .gts files #4361

Open

Description

@NullVoxPopuli

Is your feature request related to a problem? Please describe.

Ember's .gjs and .gts files open with no syntax highlighting in the StackBlitz editor. These are now the default component format for new Ember apps, so most Ember reproductions and examples on StackBlitz show up as plain text.

A .gjs file is JavaScript with embedded <template> blocks, and .gts is the same thing in TypeScript:

import { on } from '@ember/modifier';

const greet = () => alert('hi');

<template>
  <button {{on "click" greet}}>Say hi</button>
</template>

Describe the solution you'd like

Bundle the Glimmer TextMate grammar from the lifeart.vscode-glimmer-syntax extension, and map .gjs and .gts to it.

This is a grammar-only request. It needs no language server and no Glint.

Describe alternatives you've considered

  • Installing the extension by hand in Codeflow works, but every visitor has to do it themselves, and the classic editor has no equivalent. Auto-install from .vscode/extensions.json (.stackblitz config for auto install extensions #3422) would also cover this.
  • Mapping .gjs to JavaScript and .gts to TypeScript, the same fix used for Markdoc in Support Markdoc #2474, would be better than plain text. It would probably still render the <template> blocks badly.

Additional context

GitHub, Discourse (via highlight.js), Shiki, Sublime Text, Neovim (tree-sitter), and Nova all highlight these files already. The Ember guides list editor support here: https://guides.emberjs.com/release/code-editors

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions