Skip to content

Code folding not working in file with simple syntax error #49704

@amcasey

Description

@amcasey

Bug Report

🔎 Search Terms

Code folding, outlining spans

🕗 Version & Regression Information

Happens in 53b96d9

💻 Code

Open https://github.com/microsoft/TypeScript/blob/main/tests/cases/compiler/superWithTypeArgument2.ts

// We can quickly address your report if:
//  - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
//  - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
//  - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
//  - We have to pare too much extraneous code.
//  - We have to clone a large repo and validate that the problem isn't elsewhere.
//  - The sample is confusing or doesn't clearly demonstrate what's wrong.

🙁 Actual behavior

Error: Debug Failure. Did not expect CallExpression to have an Identifier in its trivia
    at addSyntheticNodes (e:\\ts_gh\\built\\local\\tsserver.js:165206:30)
    at processNodes (e:\\ts_gh\\built\\local\\tsserver.js:165184:13)
    at visitNodes (e:\\ts_gh\\built\\local\\tsserver.js:30801:24)
    at Object.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:31084:21)
    at NodeObject.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:165160:23)
    at createChildren (e:\\ts_gh\\built\\local\\tsserver.js:165194:14)
    at NodeObject.getChildren (e:\\ts_gh\\built\\local\\tsserver.js:165137:56)
    at Object.findChildOfKind (e:\\ts_gh\\built\\local\\tsserver.js:127955:26)
    at spanForCallExpression (e:\\ts_gh\\built\\local\\tsserver.js:143315:36)
    at getOutliningSpanForNode (e:\\ts_gh\\built\\local\\tsserver.js:143307:28)
    at visitNonImportNode (e:\\ts_gh\\built\\local\\tsserver.js:143123:28)
    at visitNode (e:\\ts_gh\\built\\local\\tsserver.js:30796:24)
    at Object.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:31142:24)
    at NodeObject.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:165160:23)
    at visitNonImportNode (e:\\ts_gh\\built\\local\\tsserver.js:143143:23)
    at visitNodes (e:\\ts_gh\\built\\local\\tsserver.js:30805:30)
    at Object.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:31131:24)
    at NodeObject.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:165160:23)
    at visitNonImportNode (e:\\ts_gh\\built\\local\\tsserver.js:143143:23)
    at visitNode (e:\\ts_gh\\built\\local\\tsserver.js:30796:24)
    at Object.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:30968:21)
    at NodeObject.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:165160:23)
    at visitNonImportNode (e:\\ts_gh\\built\\local\\tsserver.js:143143:23)
    at visitNodes (e:\\ts_gh\\built\\local\\tsserver.js:30805:30)
    at Object.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:31205:21)
    at NodeObject.forEachChild (e:\\ts_gh\\built\\local\\tsserver.js:165160:23)
    at visitNonImportNode (e:\\ts_gh\\built\\local\\tsserver.js:143143:23)
    at addNodeOutliningSpans (e:\\ts_gh\\built\\local\\tsserver.js:143091:21)
    at Object.collectElements (e:\\ts_gh\\built\\local\\tsserver.js:143078:13)
    at Object.getOutliningSpans (e:\\ts_gh\\built\\local\\tsserver.js:166687:50)
    at IOSession.Session.getOutliningSpans (e:\\ts_gh\\built\\local\\tsserver.js:178395:45)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (e:\\ts_gh\\built\\local\\tsserver.js:177178:61)
    at e:\\ts_gh\\built\\local\\tsserver.js:179286:96
    at IOSession.Session.executeWithRequestId (e:\\ts_gh\\built\\local\\tsserver.js:179277:28)
    at IOSession.Session.executeCommand (e:\\ts_gh\\built\\local\\tsserver.js:179286:41)
    at IOSession.Session.onMessage (e:\\ts_gh\\built\\local\\tsserver.js:179314:35)

🙂 Expected behavior

Code folding works

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions