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

Feature: Option to set motion timeouts #303

Open
MCredstoner2004 opened this issue Jul 10, 2023 · 5 comments
Open

Feature: Option to set motion timeouts #303

MCredstoner2004 opened this issue Jul 10, 2023 · 5 comments

Comments

@MCredstoner2004
Copy link

Is your feature request related to a problem? Please describe.
I'm working on a large C++ file, with a lot of characters, and after some point, [% and ]% stop working, they always reach the hardcoded timeout of 750ms and give up, MatchupWhereAmI also has similar issues btw (both use the find_unmatched function).

Describe the solution you'd like
It'd be nice to be able to change these hardcoded timeouts through an option, for when you know you're working on large files and don't mind waiting a few seconds for the cursor to move.

Describe alternatives you've considered
I also noticed that, ironically, highlighting the matching bracket was faster than going to it, this seems to be due to it using the treesitter backend, so, idk if it's possible, but maybe it'd help implementing a treesitter based find_unmatched function, which would probably help with the runtime.

Additional context
I tested manually calling the functions with the longer time outs, and they do properly go to the desired bracket, but often take several seconds (which I wouldn't normally mind given how useful they are).

@andymass
Copy link
Owner

Can you share the C++ file in question, or at least one having the issue?

I agree optimizing find_unmatched using more TS features is needed at this point. Adjusting timeouts is fine but it's better if we can return the result quickly.

@andymass
Copy link
Owner

Another thing that we can try is if this suggestion changes the performance: #302 (comment)

If so, then it may be isolated to that specific functionality.

@MCredstoner2004
Copy link
Author

MCredstoner2004 commented Jul 11, 2023

Can you share the C++ file in question, or at least one having the issue?

Yeah, I wasn't working with a file this big when I made the feature request, but since I've tested this issue on my desktop instead of my laptop, and to be able to reproduce it I had to create a much larger file
main.cpp.zip
(the file was generated by replacing a deduced type with a fully deduced one in an expression tree like matrix library I'm working of as a side project, it wouldn't be expected for anyone to write a type that specific, but that's the easiest quickest way I found of generating valid C++ code.)
If you set the cursor at line 3881 find_unmatched should go well over timeout on almost any device and as a result you can't do [%, however, if I out the cursor on the next line (3882) I immediately get the popup showing the matching namespace opening, and can jump to it just fine with %.
Due to the number of lines in the file, I increased the stopline variables to over 9000, and even on my laptop, I still get the popup with the matching bracket almost instantly.
MatchuShowTimes

@andymass
Copy link
Owner

Interestingly I can't seem to reproduce this.

From line 3381 [% goes to line 3147 due to the < in under 200ms

From line 3382 [% goes to line 3381 again on the < in under 50ms.

Could I be missing anything config-wise?

@MCredstoner2004
Copy link
Author

Ah sorry, I just can't type, it was 3881 and 3882, I'll update the previous comment just so the reproduction steps should be all there, as for config, I only configured the aforementioned stopline variables, and enabled the treesitter backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants