Skip to content

Conversation

@AndreasArvidsson
Copy link
Member

By utilizing interior scope in relative scope modifier we can skip the interior of scopes. See new test.

@AndreasArvidsson AndreasArvidsson requested a review from a team as a code owner December 13, 2025 14:13
@AndreasArvidsson
Copy link
Member Author

@pokey Mind having a look at this?

pokey
pokey previously approved these changes Dec 14, 2025
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Hard to say whether this will be nice or annoying in practice. I think worth shipping to find out

Comment on lines 214 to 216
const interiorRanges = Array.from(interiorScopes)
.filter((s) => !s.domain.contains(initialPosition))
.map((s) => s.domain);
Copy link
Member

Choose a reason for hiding this comment

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

Nitpicking here but might as well do map / filter on the stream then convert to list at the end

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean using itertools? I can have a look at that.

return islice(scopes, offset - 1, offset + desiredScopeCount - 1);
}

function getInteriorRanges(
Copy link
Member

Choose a reason for hiding this comment

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

Could use a jsdoc and a better name. Maybe like "getScopeInteriorRanges"? It's getting the top-level interior ranges for this scope right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed
Exactly nested interiors are excluded.

@AndreasArvidsson
Copy link
Member Author

@pokey Please have another look now.

@pokey
Copy link
Member

pokey commented Dec 16, 2025

Ok I made some tweaks. I expanded the comment with an example, and then tweaked the range exclusion: I think we should exclude the target ranges rather than the domain. Wdyt?

@AndreasArvidsson
Copy link
Member Author

I like your changes. The only thing still on my mind is if we really want to use itertools. At most ifilter can remove a single scope. I think for readability reasons we should probably just go back to normal array operations.

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.

3 participants