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] spec that invalid ranges are ignored #48524

Closed
jrieken opened this issue Apr 24, 2018 · 3 comments
Closed

[folding] spec that invalid ranges are ignored #48524

jrieken opened this issue Apr 24, 2018 · 3 comments
Assignees
Labels
editor-folding Editor code folding issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Apr 24, 2018

re #48352

  • have the provider and file from below
  • the provider is being called
  • the editor doesn't show folds
 vscode.languages.registerFoldingRangeProvider({ pattern: '**/*.foo' }, new class implements vscode.FoldingRangeProvider {
        provideFoldingRanges(document: vscode.TextDocument, context: vscode.FoldingContext, token: vscode.CancellationToken): vscode.ProviderResult<vscode.FoldingRange[]> {
            return [
                new vscode.FoldingRange(0, document.lineCount, vscode.FoldingRangeKind.Region)
            ]
        }
    });
this is test
this is test
this is test
@jrieken
Copy link
Member Author

jrieken commented Apr 24, 2018

It seems that document.lineCount is the culprit... The docs on the ctor aren't very clear and there is no validation/warning message printed...

@jrieken jrieken changed the title FoldingProvider doesn't work? FoldingProvider results slightly dropped Apr 24, 2018
@jrieken jrieken changed the title FoldingProvider results slightly dropped FoldingProvider results silently dropped Apr 24, 2018
@aeschli aeschli added this to the May 2018 milestone May 2, 2018
@aeschli aeschli added the editor-folding Editor code folding issues label May 2, 2018
@aeschli aeschli changed the title FoldingProvider results silently dropped [folding] FoldingProvider results silently dropped May 4, 2018
@aeschli aeschli changed the title [folding] FoldingProvider results silently dropped [folding] spec that invalid ranges are ignored May 4, 2018
@aeschli
Copy link
Contributor

aeschli commented May 4, 2018

Yes, end line must be a line that exists in the document (< document.lineCount).
I updated the spec.

@aeschli aeschli closed this as completed in 48792c1 May 4, 2018
@aeschli aeschli added the verification-needed Verification of issue is requested label May 29, 2018
@dbaeumer
Copy link
Member

Verified that doc got updated.

@dbaeumer dbaeumer added the verified Verification succeeded label May 31, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-folding Editor code folding issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants