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

More customisable folding #77549

Closed
Qhesz opened this issue Jul 18, 2019 · 1 comment
Closed

More customisable folding #77549

Qhesz opened this issue Jul 18, 2019 · 1 comment
Assignees
Labels
editor-folding Editor code folding issues

Comments

@Qhesz
Copy link

Qhesz commented Jul 18, 2019

Context

Golang code can be quite verbose, a standard function call is written as:

result, err := someFunction()
if err != nil {
    return nil, fmt.Errorf("some context: %v", err)
}

Finding acceptable ways to shorten the above is an ongoing, high profile discussion in the Golang community, and I think there's an opportunity for editors like VSCode to help provide a solution.

The current folding behaviour in VSCode could collapse the above to:

result, err := someFunction()
if err != nil {...

Which is not helpful, as it hides the action taken in the case of an error.

What I'd love to see

Somehow enable the folding behaviour to display:

result, err := someFunction()
...check... fmt.Errorf("some context: %v", err) ...

Where check is some name that represents what folding behaviour has been applied.

The code could then be read as if it were written with some kind of macro (which golang deliberately does not support), but the actual file text would be standard Golang code.

I'd also like the above to somehow be folded automatically. For example, once I have the folding configured, a new file I open has these regions folded by default, and once I type a new block and save the file, the new block is folded as well.

(This suggestion is similar to #70794, but I'm looking for a solution to a very well defined use case, with an entire language community that would love to see this implemented. #31966 and #69078 are also related)

@vscodebot vscodebot bot added the editor-folding Editor code folding issues label Jul 18, 2019
@aeschli
Copy link
Contributor

aeschli commented Jul 18, 2019

sounds like a dup of #70794

@aeschli aeschli closed this as completed Jul 18, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-folding Editor code folding issues
Projects
None yet
Development

No branches or pull requests

2 participants