Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DanielRosenwasser opened this issue Nov 1, 2019 · 1 comment · Fixed by #35586
Closed

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

DanielRosenwasser opened this issue Nov 1, 2019 · 1 comment · Fixed by #35586
Labels
Domain: Error Messages The issue relates to error messaging Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Experience Enhancement Noncontroversial enhancements Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Nov 1, 2019

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.
@DanielRosenwasser DanielRosenwasser added Domain: Error Messages The issue relates to error messaging Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this labels Nov 1, 2019
@DanielRosenwasser DanielRosenwasser added this to the Backlog milestone Nov 1, 2019
@DanielRosenwasser DanielRosenwasser added the Experience Enhancement Noncontroversial enhancements label Nov 1, 2019
@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Dec 10, 2019
@DanielRosenwasser
Copy link
Member Author

Thanks @Toxyxer! A great follow-up would be to make this work for

  • } braces in object literals and namespaces
  • Parentheses in
    • parenthesized expressions
    • function calls
    • new expressions
  • Square brackets for arrays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Error Messages The issue relates to error messaging Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Experience Enhancement Noncontroversial enhancements Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants