microsoft / microsoft/TypeScript-TmLanguage

Broken syntax highlighting for async generic arrow functions with multiline arguments

Open
#819 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback
Dominant language
TypeScript
Stars
471
Forks
149
PR merge metrics
No merged PRs in 30d

Description

TS and JS Grammar Extension version: 0.0.53 / latest

Syntax highlighting breaks for async generic arrow functions, whose arguments span multiple lines. This is basically the same problem as #481 but with async keyword

Code

async <TData, TError extends string = string>(
  url: string,
  config?: AxiosRequestConfig,
): Promise<Result<TData, TError>> => {
  try {
    const { data } = await Axios.get<ServerResponse<TData, TError>>(
      url,
      config,
    )
    return Result.fromResponse(data)
  } catch (e) {
    return handleError<TData, TError>(e)
  }
}

image

It works fine when I either move type arguments to next line/remove async/move arguments to one line. In the first two cases, type arguments and normal arguments highlighting doesn't work though.

image
image
image

Just noticed GitHub highlighting breaks as well. Is it a grammar limitation?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the highlighting failure with the async generic arrow-function example in the issue, then compare it with the referenced #481 case. Trace the TypeScript/JavaScript grammar behavior for multiline arguments and verify that the example and its stated variants highlight correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.