cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Contiguous scope

Open AndreasArvidsson opened this issue 2 years ago • 6 comments

Fixes #1835

Now implemented as a modifier of the comment scope

~~I decided to implement this as a scope type instead of a modifier. Now you can say things like chuck fat comment or changed next fat alpha. This behavior of having alternatives to existing scopes is already something we started with BoundedNonWhitespaceSequenceStage albeit in a less capacity.~~

Checklist

  • [x] I have added tests
  • [-] I have updated the docs and cheatsheet
  • [x] I have not broken the cheatsheet

AndreasArvidsson avatar Dec 06 '23 05:12 AndreasArvidsson

@pokey @josharian The current implementation now only effects the command scope type and there is no spoken form for it.

AndreasArvidsson avatar Dec 14 '23 15:12 AndreasArvidsson

Won't this cause adjacent multiline comments to be merged as well? eg

/*
 * foo
 */
/*
 * bar
 */

Looking at this, it feels like not a particularly big deal 😅. But figured I'd point it out as I don't think it quite matches what we discussed

pokey avatar Dec 14 '23 17:12 pokey

Yes unless we make this more comment specific and check for single line ranges. Ideally we would have single and multi-line as separate scopes and only use this for single line.

Or add a new predicate for contiguous scope. That is probably the best solution?

AndreasArvidsson avatar Dec 14 '23 17:12 AndreasArvidsson

hmm so the predicate would just set a flag on the capture. I think that sounds reasonable?

pokey avatar Dec 14 '23 17:12 pokey

Yes exactly.

AndreasArvidsson avatar Dec 14 '23 17:12 AndreasArvidsson

There is no problem really with this implementation except for the fact that in javascript there is no Tree sitter difference between block and line comments. I guess that contiguous predicate could take a boolean that requires single line ranges? Or a regex pattern?

edit: Solved with a regex pattern

AndreasArvidsson avatar Dec 15 '23 07:12 AndreasArvidsson