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] highlight folded line #83983

Closed
mymage opened this issue Nov 5, 2019 · 11 comments · Fixed by #84955
Closed

[folding] highlight folded line #83983

mymage opened this issue Nov 5, 2019 · 11 comments · Fixed by #84955
Assignees
Labels
editor-folding Editor code folding issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@mymage
Copy link

mymage commented Nov 5, 2019

It would be useful if the collapsed lines were highlighted.

Actual code expanded:
0000000

Actual code collapsed:
11111

Proposal for an highlight of collapsed code:
22222
Perfect if with color highlight configurable on settings.

Thanks

@aeschli aeschli changed the title Highlight of collapsed code [foling] highlight folded line Nov 6, 2019
@aeschli aeschli changed the title [foling] highlight folded line [folding] highlight folded line Nov 6, 2019
@aeschli aeschli added the editor-folding Editor code folding issues label Nov 6, 2019
@aeschli aeschli added this to the Backlog milestone Nov 6, 2019
@aeschli aeschli added the feature-request Request for new features or functionality label Nov 6, 2019
@dbeigi
Copy link
Contributor

dbeigi commented Nov 7, 2019

Hi @aeschli, I would like to give this a shot.

@aeschli
Copy link
Contributor

aeschli commented Nov 7, 2019

@dbeigi Great. Have a look at https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/folding/foldingModel.ts#L91
There we create a decoration that is used not only for the +/- action but alsofor the ...
Righ now it starts at the last character.
A simple fix might be to have it start at character 0, and give it a background color

@dbeigi
Copy link
Contributor

dbeigi commented Nov 8, 2019

@aeschli appreciate the direction

@dbeigi
Copy link
Contributor

dbeigi commented Nov 13, 2019

@aeschli do you have any suggestions on adding the background color?

@aeschli
Copy link
Contributor

aeschli commented Nov 14, 2019

@mymage

private static readonly COLLAPSED_VISUAL_DECORATION = ModelDecorationOptions.register({
defines a decoration that you can use to also add a background color:

	private static readonly COLLAPSED_VISUAL_DECORATION = ModelDecorationOptions.register({
		stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
		afterContentClassName: 'inline-folded',
		className: 'folded-background',
		isWholeLine: true,
		linesDecorationsClassName: 'codicon codicon-chevron-right'
	});

And in folding.css:

.monaco-editor .folded-background {
	background-color: yellow;
}

Now the remaining work is to make the color configurable.

registerThemingParticipant((theme, collector) => {

is an example on a css that is generated based on theme colors.

@mymage
Copy link
Author

mymage commented Nov 16, 2019

@aeschli , sorry I'm not very confident with these language: you intend that I can apply these code on my local files to try the feature?

@aeschli
Copy link
Contributor

aeschli commented Nov 18, 2019

@mymage Sorry, no, this was just intended to help @dbeigi which offered to work on a PR implementing the feature.

aeschli added a commit that referenced this issue Dec 19, 2019
Fixed #83983 added highlight collapsed
@ianwesterfield
Copy link

ianwesterfield commented Jan 3, 2020

Am I missing where this can be disabled in settings?
Just saw the comment from @aeschli on PR #84955. What was the reasoning behind not requiring this be controlled by a setting? It's the first place I looked to disable the highlighting.

@usernamehw
Copy link
Contributor

You can use transparent color:

"workbench.colorCustomizations": {
	"editor.foldBackground": "#fff0",
}

The reason is probably because there's a lot of settings already.

aeschli added a commit that referenced this issue Jan 5, 2020
@aeschli
Copy link
Contributor

aeschli commented Jan 5, 2020

I added a setting editor.foldingHighlight

@aeschli aeschli modified the milestones: Backlog, January 2020 Jan 5, 2020
@aeschli aeschli added the verification-needed Verification of issue is requested label Jan 28, 2020
@aeschli
Copy link
Contributor

aeschli commented Jan 28, 2020

To verify:

  • configure folded region highlight color:
"workbench.colorCustomizations": {
	"editor.foldBackground": "#fff0",
}
  • enable/disable feature:
    "editor.foldingHighlight": false

@RMacfarlane RMacfarlane added the verified Verification succeeded label Jan 29, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 2, 2020
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 verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants