Skip to content

Conversation

@sjbarag
Copy link

@sjbarag sjbarag commented Oct 31, 2025

A tagged template call with a generic was previously parsed as a pair of '<' and '>' binary expressions. TypeScript supports type arguments on tagged template calls (e.g. 'lorem`dolor sit amet`'), so parse them properly.

A tagged template call with a generic was previously parsed as a pair of
'<' and '>' binary expressions. TypeScript supports type arguments on
tagged template calls (e.g. 'lorem<Ipsum>`dolor sit amet`'), so parse
them properly.
sjbarag added a commit to sjbarag/helix that referenced this pull request Nov 3, 2025
GraphQL injections previously only operated on a 'gql' tagged template
literal, but a few more options are supported by the official VSCode
'GraphQL: Syntax Highlighting' extension:

    // Already supported
    gql`query { foo }`;

    // New
    gql('query { foo }');
    gql(`query { foo }`);

    graphql`query { foo }`;
    graphql('query { foo }');
    graphql(`query { foo }`);

    '#graphql query { foo }';
    `#graphql query { foo }`;

    /* GraphQL */ 'query { foo }';
    /* GraphQL */ `query { foo }`;

Note that until a PR in tree-sitter-typescript[^1] is merged upstream
and updated here, tagged template literals with type arguments (e.g.
'gql<SomeType>`query { foo }`;') won't have a working injection.

supports helix-editor#14413

[^1]: tree-sitter/tree-sitter-typescript#350
sjbarag added a commit to sjbarag/helix that referenced this pull request Nov 3, 2025
GraphQL injections previously only operated on a 'gql' tagged template
literal, but a few more options are supported by the official VSCode
'GraphQL: Syntax Highlighting' extension:

    // Already supported
    gql`query { foo }`;

    // New
    gql('query { foo }');
    gql(`query { foo }`);

    graphql`query { foo }`;
    graphql('query { foo }');
    graphql(`query { foo }`);

    '#graphql query { foo }';
    `#graphql query { foo }`;

    /* GraphQL */ 'query { foo }';
    /* GraphQL */ `query { foo }`;

Note that until a PR in tree-sitter-typescript[^1] is merged upstream
and updated here, tagged template literals with type arguments (e.g.
'gql<SomeType>`query { foo }`;') won't have a working injection.

supports helix-editor#14413

[^1]: tree-sitter/tree-sitter-typescript#350
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.

1 participant