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

[folding] instead of '...' show body content for short methods #76396

Closed
procodix opened this issue Jul 1, 2019 · 3 comments
Closed

[folding] instead of '...' show body content for short methods #76396

procodix opened this issue Jul 1, 2019 · 3 comments
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality
Milestone

Comments

@procodix
Copy link

procodix commented Jul 1, 2019

This function will allow to toggle the code view to "compact" mode. Compact mode means that short methods will be displayed as a one-liner. It looks similar to a folded methods, but the method's body remains visible. A method is conisdered short, if it fits on one line in the current viewport, or if it is shorter than a configurable number of lines / characters.

Technically a compacted method simply replaces all line-breaks with a blank/space, while it has no focus.

The feature operates completely in memory, the underlying editied file remains unchanged. If a compacted method is focused, by clicking or moving the cursor inside its body, it transforms to its original view, so that editing looks and works as expected. The cursor simply remains at the clicked position, while the line-breaks are restored. By Clicking outside the method being edited, it returns to compact mode.

Benefit is better readability for short methods. Compared to folding, all code remains visible, and no toggles are required. Optimizes real estate use on wide screen displays.

Example for "Normal View"
PHP:

public function Test($aParam)
{
    $this->Test = $aParam;
    return $this;
}

CSS:

body {
    background:#f00; 
    color:#000;
    border:1px solid #ff0000;
    font-size:1.6rem;
}

"Compact View":
PHP:
public function Test($aParam) {$this->Test = $aParam; return $this;}

CSS:
body {background:#f00; color:#000; border:1px solid #ff0000; font-size:1.6rem;}

@vscodebot vscodebot bot added the editor-folding Editor code folding issues label Jul 1, 2019
@aeschli aeschli added the feature-request Request for new features or functionality label Jul 2, 2019
@aeschli aeschli added this to the Backlog milestone Jul 2, 2019
@aeschli
Copy link
Contributor

aeschli commented Jul 2, 2019

Nice idea!

@procodix
Copy link
Author

procodix commented Jul 2, 2019

it should be added, that in the case of LESS, recursion is neccessarry:

.test {
    background:#f00; 
    color:#0f0;
    img {
        width:100%;
        boder:1px solid #f00;
    } 
}

would transform to:

.test {background:#f00; color:#0f0;
    img {width:100%; boder:1px solid #f00;} 
}

Focusing ".test" class by setting the cursor on one of its attributes would leave "img" definition compacted.

@aeschli aeschli changed the title New View Option: Compact Methods [folding] New View Option: Compact Methods Sep 6, 2019
@aeschli aeschli changed the title [folding] New View Option: Compact Methods [folding] instead of '...' show body content for short methods Sep 6, 2019
@aeschli
Copy link
Contributor

aeschli commented Oct 9, 2019

dup of #70794

@aeschli aeschli closed this as completed Oct 9, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 25, 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 feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants