Skip to content

Surrounding pairs: Fall back to text based algorithm when error node is detected. #1558

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
merged 1 commit into from
Jul 9, 2023

Conversation

AndreasArvidsson
Copy link
Member

Fixes #712

Checklist

@AndreasArvidsson AndreasArvidsson requested a review from pokey as a code owner July 2, 2023 12:00
@AndreasArvidsson AndreasArvidsson changed the title Surrounding pairs: Fall back to text based algorithm when error nodes is detected. Surrounding pairs: Fall back to text based algorithm when error node is detected. Jul 2, 2023
@@ -148,3 +160,22 @@ function processSurroundingPairCore(
scopeType,
);
}

function nodeHasError(node: SyntaxNode, includeChildren = false): boolean {
Copy link
Member

Choose a reason for hiding this comment

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

This seems quite conservative. Are there test cases that fail if you don't eg check grand-siblings?

Copy link
Member Author

Choose a reason for hiding this comment

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

The added test for example. The error node is a child to an ancestor of the selected node.

Copy link
Member

Choose a reason for hiding this comment

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

as discussed, let's use your proposed version for now and if it becomes bothersome we can revisit. see also #1600

@pokey pokey added this pull request to the merge queue Jul 9, 2023
Merged via the queue into main with commit 69679de Jul 9, 2023
@pokey pokey deleted the surrounding-pair-errors branch July 9, 2023 16:12
@pokey pokey added the bug Something isn't working label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Surrounding pair problem in error python code
2 participants