Skip to content

Conversation

@AndreasArvidsson
Copy link
Member

  • Interior domain is now same as content range (before shrinking to text content). "take inside" with the cursor on a function name will not select function body anymore.
  • Interior of typed target now utilities every scope. "take inside funk" will select function body. "take inside state" will select all branch bodies in an if statement.

@AndreasArvidsson AndreasArvidsson requested a review from a team as a code owner November 10, 2025 10:36
Comment on lines 26 to 36
// eg `inside funk`
// The reason for this being an every scope when we have an explicit scope
// type is because we are looking for interiors inside of the scope. We
// don't want a normal containing behavior that expands.
if (target.hasExplicitScopeType) {
const everyModifier = this.modifierHandlerFactory.create({
type: "everyScope",
scopeType: {
type: "interior",
},
});
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit surprised that this actually works. For example, in:

function aaa(bbb: ccc) {
   ddd;
}

If I say "clear inside funk air", how come you don't get:

function aaa(|) {
   |
}

Copy link
Member

Choose a reason for hiding this comment

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

ohh I guess it's because (bbb: ccc) is surroundingPairInterior whereas this is explicitly requestiont interior?

Copy link
Member

Choose a reason for hiding this comment

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

So that means that even for {}-style languages, we still need to define interior in tree-sitter if we want "inside funk" to work?

Copy link
Member

Choose a reason for hiding this comment

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

Ok here's a pathological case:

function aaa(bbb = () => { return "ccc"; }) {
   ddd;
}

In this case, you'd expect "clear inside air" to give:

function aaa(bbb = () => { return "ccc"; }) {
   |
}

but instead you'd get:

function aaa(bbb = () => { | }) {
   |
}

I think this is an ok compromise, but just figured I'd flag to demonstrate why this approach is really just a hack that approximates what we actually want

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly. inside scope completely rely on Tree sitter.

Maybe I can work around this. It's not perfect, but I think this is a decent solution for now.

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