cursorless-dev / cursorless

Don't let the cursor slow you down
https://www.cursorless.org/
MIT License
1.13k stars 79 forks source link

Migrated surrounding pair scope handler #2457

Closed AndreasArvidsson closed 2 months ago

AndreasArvidsson commented 3 months ago

Fixes #2316

Checklist

AndreasArvidsson commented 3 months ago

I would argue that this is not a matching delimiter pair at all. It is the scope type string which we have no spoken form for at the moment. https://github.com/cursorless-dev/cursorless/blob/766864d9fa979124283b236bbb4738204a13fe45/data/fixtures/recorded/languages/ruby/changeString2.yml

AndreasArvidsson commented 3 months ago

This is really interesting

"if the file is over 30MB or over 300k lines, we consider it to be a very large file and proceed to turn off very many features, including tokenization, word wrapping, indent guides, anything that would consume additional memory, etc." https://github.com/Microsoft/vscode/issues/32118#issuecomment-320952246

That means that Cursorless can never encounter a file with over three hundred thousand lines. I just did a test with the surrounding pair regex on a file with just below three hundred thousand lines and that clocked in at 274ms. I would say that is a bit on the high side so we might want to do some windowing, but we definitely don't need to be as careful as we was before. Doing it at tens of thousand lines at the time probably is fine.

pokey commented 2 months ago

is there a reason this is still marked as draft? Looks like there's some unchecked boxes in description too

AndreasArvidsson commented 2 months ago

Yes the checkboxes in the description are not done. I wasn't sure this implementation was going to get your approval so I didn't go further originally.

pokey commented 2 months ago

Got it. So would it make sense to knock those out now that we're aligned on the high-level direction or did you want me to take a look first?

AndreasArvidsson commented 2 months ago

Please have a look first. Some of the implementation details I'm not sure off myself. The single line strings is one thing that come to mind.

AndreasArvidsson commented 2 months ago

@pokey That simplification looks great! :)

pokey commented 2 months ago

Ok I've now fully reviewed this PR. I made a bunch of changes. I think what remains are:

Getting really close tho! Very excited to have this one

AndreasArvidsson commented 2 months ago

Ready for review. I have added @disqualifyDelimiter to all the languages that have boolean expressions(using </>) to my knowledge.

AndreasArvidsson commented 2 months ago

@pokey I have now gone through all the grammar json files and added all the operators I can find that clashes. I might have missed something; some of these files are quite long and complicated, but I done my best.

AndreasArvidsson commented 2 months ago

wow that disqualify stuff looks like it was a lot of work. Nice job. We should prob have some negative tests, ie that we're not disqualifying delimiters that we do want, but I think we have some tests for those and this PR is growing long in the tooth so I'd be happy to leave those for now.

As discussed, let's drive this for a couple days and then ship it

It was definitely some effort. We have a few tests. If anything comes to mind please record a few. Otherwise I would like to just get this in at the stage. I've been running it for this entire day and except for the bug that was fixed earlier it has been working fine.

pokey commented 2 months ago

I wonder if we should make iteration scope be "line". I think being able to say "first string" / "last string" will be really useful

AndreasArvidsson commented 2 months ago

I wonder if we should make iteration scope be "line". I think being able to say "first string" / "last string" will be really useful

Why not?