microsoft / microsoft/TypeScript

Report candidates on closing list terminators

Open
#34,871 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: Error Messages Effort: Difficult Experience Enhancement
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

From @robpalme: https://twitter.com/robpalmer2/status/1190383568612184064

function base_init() {
{
    
}

    function me() {
    
}

https://www.typescriptlang.org/play/?ssl=8&ssc=1&pln=9&pc=1#code/GYVwdgxgLglg9mABAIwIYGcCmB9GYZQAUAlIgN4BQliNiFAvhRbYqJLAogLaYnnO0GFIA

Motivation

When an ending curly brace (or similar) is missing, we can give some better hints to the user.

In some cases, this might be because a stray } throws parsing off.

Suggestion

It would be very cool to explain a possible reason that the user is getting a '}' expected error:

}
~
This '}' occurs at the same indentation level, but corresponds to a different brace.

Contributor guide

Open the contributing guide

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

Start by reproducing the example in the linked TypeScript Playground and inspect the resulting '}' expected diagnostic. Determine how closing-list terminators are identified and how an indentation-level mismatch could be reported. Done means the example produces the suggested hint without degrading other brace-parsing diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.