This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Fix catch parameter highlighting#220
Merged
sadikovi merged 3 commits intoatom:masterfrom Dec 8, 2019
Vigilans:vigilans/catch-parameter
Merged
Fix catch parameter highlighting#220sadikovi merged 3 commits intoatom:masterfrom Vigilans:vigilans/catch-parameter
sadikovi merged 3 commits intoatom:masterfrom
Vigilans:vigilans/catch-parameter
Conversation
sadikovi
suggested changes
Dec 7, 2019
Contributor
sadikovi
left a comment
There was a problem hiding this comment.
Added tests don't cover all of the code changes.
Contributor
Author
|
I enriched the two testcases by inserting comments into possbile locations related with my changes. |
sadikovi
approved these changes
Dec 8, 2019
Contributor
sadikovi
left a comment
There was a problem hiding this comment.
Looks good, thanks for updating the test!
Contributor
|
Merging to master, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Uses a two-scope begin/end model to correctly highlight catch parameter.
It wraps
Exception ... |orException ... )as a scope, allowing parameter to only sit in this scope, to resolve the parsing sequence issue (first exception type, then parameter identifier).Alternate Designs
A more complex two-scope design:
(...Exception|...Exceptionparameter...)Problem: cannot correctly highlight when there's a storage-modifer (like final)
Recursive design:
It makes use of the fact that
catch (ex1 | ex2 | ex3 param)is in terms of structure the same ascatch (ex1 (ex2 (ex3 param)(every time a|is met, the remaining part is actually a new catch-parameter pattern)Problem: still cannot elegantly handle the base case:
catch (final ex3 param).Benefits
Can correctly highlight catch parameter when it is placed in new line or with a comment in between.
Possible Drawbacks
Don't see any afak.
Applicable Issues
Fix #219