Skip to content

(GH-1459) Folding provider should not crash with mismatched region tokens #1461

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

Merged

Conversation

glennsarti
Copy link
Contributor

PR Summary

Previously the folding provider would crash with an error if the document
contained mismatched begin and end region comments e.g. If the document
started with # endregion. This was due to the token stack code always
assuming there was at least one element in the stack. This commit modifies
the end region detection to only trigger if there was a previous begin region.

Fixes #1459

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • Tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

… region tokens

Previously the folding provider would crash with an error if the document
contained mismatched begin and end region comments e.g. If the document
started with `# endregion`.  This was due to the token stack code always
assuming there was at least one element in the stack.  This commit modifies
the end region detection to only trigger if there was a previous begin region.
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Glenn, you rock 👍

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TylerLeonhardt TylerLeonhardt merged commit d3ce263 into PowerShell:master Aug 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

orphan endregion disables folding.
3 participants