Skip to content

Related spans on missing list/block/function body terminators #34870

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

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

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

Specifically, we can use a related span and explain where the corresponding starting point is:

function base_init() {
                     ~
The parser expected to find a '}' to match the '{' token here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Error MessagesThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Experience EnhancementNoncontroversial enhancementsFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions