microsoft / microsoft/TypeScript

Folding function calls folds closing parenthesis

Open
#40,242 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 4.0.1-rc, 4.0.2, 4.1.0-dev.20200825

Search Terms:
fold call function parenthesis bracket

Code

declare const f: (_: unknown) => void
f({
  a: 3
})
f(
  3
)

Expected behavior:

The function calls should fold like this:

f({ // ...
})
f( // ...
)

This was the behaviour for the first function call in 4.0.0 because of the object literal:
screenshot of folding behaviour in TS 4.0.0

Actual behavior:

The function calls fold like this, including the last line with the closing parenthesis:

f({ // ...
f( // ...

screenshot of folding behaviour in TS 4.0.1 onwards

Playground Link: I couldn't reproduce this in the playground, so I'm not sure if this is an issue with VSCode.

Related Issues: may have been caused by #39109 which fixes #38597 (it was the only relevant issue I found that was fixed for 4.0.1 and this bug doesn't occur in 4.0.0)

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

Reproduce the folding behavior with the TypeScript versions listed and compare 4.0.0 with 4.0.1 onward in VS Code. Read related issues #39109 and #38597 first; the fix is complete when multiline function calls fold while leaving their closing parentheses visible, with regression coverage for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.