microsoft / microsoft/TypeScript-TmLanguage
Broken syntax highlighting for async generic arrow functions with multiline arguments
Nobody has claimed this yet.
- 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)
}
}

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.



Just noticed GitHub highlighting breaks as well. Is it a grammar limitation?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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