microsoft / microsoft/TypeScript-TmLanguage

Typescript syntax highlighting: Problem with JSDoc comments with JSON inside `@default` tag

Open
#1,037 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Type: Bug

When entering a JSON object as the value for a @default tag, the first opening curly bracket is treated as part of the code.

For example:

class X {
  /**
   * @default { "a": 1 }
   */
  foo: any;
}

Is displayed as:
image

VS Code version: Code - Insiders 1.91.0-insider (b36286db80c68b7fdc6bfee2f55e0208c8833dfc, 2024-06-25T09:14:46.370Z)
OS version:
Modes:

System Info: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Extensions (16)

Extension Author (truncated) Version
anycode-c-sharp ms- 0.0.5
anycode-typescript ms- 0.0.5
anycode ms- 0.0.73
anycode-php ms- 0.0.6
anycode-python ms- 0.0.5
anycode-rust ms- 0.0.6
anycode-java ms- 0.0.5
anycode-kotlin ms- 0.0.5
anycode-go ms- 0.0.5
anycode-cpp ms- 0.0.5
remotehub Git 0.63.2024061801
codespaces Git 1.16.23
azure-repos ms- 0.39.2024061901
remote-server ms- 1.6.2024061709
remote-explorer ms- 0.5.2024061309
remote-repositories ms- 0.41.2024022202

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 TypeScript syntax-highlighting issue using the JSDoc example in the report, then inspect the grammar entry points that classify @default tags and JSON-like braces. The work is done when the opening brace in the JSON value is highlighted as part of the tag value rather than as code, with relevant grammar tests updated if the repository provides them.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.