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

Eliminate uneccesary calls to isRangeCommentedOrString #346

Merged
merged 1 commit into from Mar 20, 2018

Conversation

Projects
None yet
2 participants
@Doekeb
Contributor

Doekeb commented Mar 19, 2018

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

Fixes #341.

By design, brackets inside strings or comments are not matched. The previous behavior was that when the cursor was next to any bracket, even a bracket inside a comment or string, a search was performed for that bracket's closing pair. That search passes over comment or string scopes, so if a line read "(example words [cursor here])", bracket-manager would search the entire document and ultimately fail to find a match for the last ), even though it should not have performed the search in the first place. This PR simply stops bracket-manager from performing these searches when the bracket in question is in a comment or string scope.

Alternate Designs

Do match brackets inside strings and comments. This has already been shown to be a bad idea.

Benefits

Much faster performance in large files with many brackets. For instance, in language-latex, the following is considered a string scope: $here is some math$ so in a long document with lots of braces (almost any medium/long math paper fits this description), either of the following, or anything similar, would cause significant lag:
$\frac{numerator}{demonimator[cursor here]}$
$\sum_{n=1[cursor here]}^\infty n$.

Possible Drawbacks

None.

Applicable Issues

#341
James-Yu/Atom-LaTeX#131

@Doekeb Doekeb changed the title from :racehorse: Eliminate uneccesary calls to isRangeCommentedOrString to Eliminate uneccesary calls to isRangeCommentedOrString Mar 19, 2018

@smashwilson

This comment has been minimized.

Member

smashwilson commented Mar 20, 2018

👍 Nice.

@smashwilson smashwilson merged commit f4511d6 into atom:master Mar 20, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment