Skip to content
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

Some syntax highlighting does not work in TypeScript when a function has several return types #134440

Closed
itayperry opened this issue Oct 5, 2021 · 4 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@itayperry
Copy link

itayperry commented Oct 5, 2021

  • VS Code Version: 1.60.2

If all return types are aligned in one line than the coloring works - but beautifying packages such as prettier will always make it fall down. I don't understand why the highlighting doesn't work.

Steps to Reproduce: just write a function in TypeScript that has many types of return value:

image

As you can see, the const and the return don't get highlighted :(

Another (silly) example:

image

@Lemmingh
Copy link
Contributor

Lemmingh commented Oct 5, 2021

Minimum reproducible case:

class c {
    m(): number
        | Promise<boolean> {
        return 5;
    }
}

The meta.method.declaration.ts and meta.return.type.ts scopes are lost after a line ending. Then, the last generic makes it further wrong, causing meta.objectliteral.ts.

@Lemmingh
Copy link
Contributor

Lemmingh commented Oct 5, 2021

This case is so similar to microsoft/TypeScript-TmLanguage#812 (comment) that I guess it might be a good one to push forward #77140

@itayperry
Copy link
Author

@Lemmingh thank you for replying and looking into it so quickly :)

@mjbvz mjbvz added *duplicate Issue identified as a duplicate of another issue(s) upstream-issue-linked This is an upstream issue that has been reported upstream labels Oct 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants
@mjbvz @itayperry @Lemmingh and others