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

Lines containing spaces should be handled the same no matter where in a file #8427

Closed
kieferrm opened this issue Jun 28, 2016 · 4 comments
Closed
Assignees
Milestone

Comments

@kieferrm
Copy link
Member

Testing #8232. Create a simple file without any file extension.

In the following picture all green areas are showing lines that only contain whitespace characters. I can come up with rules why indentation guides are shown the way they are but I think all non-empty lines (including those containing whitespace only) should be handled the same no matter where they are in a file. I.e. the context of the line should be ignored.

screen shot 2016-06-28 at 11 48 50 am

@alexdima
Copy link
Member

@kieferrm
The indent guides use 100% the folding regions. I have just pushed a change that improves whitespace-only or empty lines:

This is the new rendering:
image

My change also makes it that the indent guides respect 100% the folding regions -- you can inspect this by hovering over the line decorations area between the line numbers and the content and the folding regions should reflect the indent guides.

I don't know why we don't create a folding region for the last lines in the file. @aeschli here is a copy-paste friendly version of Kai's screen shot:


    indent1
        indent2
        indent2
    indent1



indent0
    indent1

 indent 0.5




indent0
    indent1
    indent1




indent0









@alexdima
Copy link
Member

@aeschli Here is where I moved your code that computes folding regions:

https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/model/indentRanges.ts#L32

@aeschli
Copy link
Contributor

aeschli commented Aug 5, 2016

@alexandrudima A folding region only exists if there it at least one non empty line that has a larger indent than a non-empty line before

line 1

line 2

does not have any folding regions. Think of code like

console.log('hello');

console.log('world');

line 1

line 2
  line 3

has one folding region at line 2 (ending at the end of the file).

IMO from the perspective of folding regions the algorithm does the right thing.

@aeschli aeschli assigned alexdima and unassigned aeschli Aug 5, 2016
@alexdima alexdima added this to the Backlog milestone Aug 8, 2016
@alexdima
Copy link
Member

Closing as per Martin's explanation

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants