Skip to content
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

Add getEnclosingFunction logic for range expansion in edits + chats (and possibly other commands) #3495

Closed
umpox opened this issue Mar 21, 2024 · 2 comments
Assignees
Labels

Comments

@umpox
Copy link
Contributor

umpox commented Mar 21, 2024

What:

  • Edits and Chats currently expand a cursor position to the nearest folding range. This is ok, but it isn’t ideal, there are many cases where this fails for us. For example, an “it” block inside a “describe” block in a JS test is not seen as a folding range, so we always expand the selection to the full “describe” block.
  • Ideally we can always expand to the nearest enclosing function if available, before falling back to the folding range logic.

How:

  • Add a tree-sitter query to find the nearest enclosing function
  • Update our Smart Selection logic to look for this first.
  • This should automatically add this behaviour to chat and edit.
@umpox umpox self-assigned this Mar 21, 2024
@umpox umpox changed the title Add getEnclosingFunction logic for range expansion in edits (and possibly other commands) Add getEnclosingFunction logic for range expansion in edits + chats (and possibly other commands) Mar 21, 2024
@chillatom
Copy link

Adding an issues that I hope this might address. Where the user cursor is within a massive class, we throw an error saying "selected text is too long", would be nice to gracefully handle that.

https://sourcegraph.slack.com/archives/C05AGQYD528/p1711134734677989

@umpox
Copy link
Contributor Author

umpox commented Mar 25, 2024

Closed by #3507

@umpox umpox closed this as completed Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants