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

Strategy for improving balancing and pair scope #23

Closed
17 of 19 tasks
LunarWatcher opened this issue Feb 24, 2021 · 1 comment
Closed
17 of 19 tasks

Strategy for improving balancing and pair scope #23

LunarWatcher opened this issue Feb 24, 2021 · 1 comment
Assignees

Comments

@LunarWatcher
Copy link
Owner

LunarWatcher commented Feb 24, 2021

  • 0. Testing (ongoing goal) [Potentially complex; shouldn't be hard]
  • 1. Clean up and document
    • 1. more files (primarily for all the s: functions; they can be rescoped, and their current scope prevents backwards compatibility problems, and once again breaking people's config. One per major update is enough); [Easy] -- the easy bit is done - the rest is a part of modularizing the code, and comes later
    • 2. more comments - document the intricate parts of the code as much as possible to avoid wasting time on deciphering use. [Hard]
    • 3. Extend functionality for more complex rules [hard]
    • 4. Investigate extension of pair functionality by using substitute on-demand -- not viable: balancing checks would have to be multiline to prevent spamming out new close characters for sufficiently complex patterns, there would have to be separate regexes for jumping, and just a whole lot of extra data opening for a lot more bugs
    • 5. Add functions for adding pairs instead of using the variable. This also lets us deprecate the init method (gonna do that quick and painfully with an echoerr deprecation notice, and complete removal when 3.0.0 is actually, properly released) [Medium]
  • 2. Temporarily completely remove the feature triggering Nested brackets detection is broken across newlines #21 (temporarily completes Nested brackets detection is broken across newlines #21 and re-breaks Auto delete pair & auto jump #19) [Hard]
  • 3. Modularity:
  • 4. Extend balancing rules by taking highlight groups into account
    • 1. Make an option for more fine-grained balancing control in comments (not sure how this is gonna work yet - finding comments is fine, no idea how we're doing balancing control though) [Easy when details are properly worked out]
    • 2. Make an option for extended ' ignore (current behavior: only abcd'; thought behavior: option that i.e. lets both abcd' and (1+2x)' not trigger expansion) [Easy]
    • 3. Make an option to ignore pairs in strings when outside strings, and vice versa [Complex]
    • 3a. Make an option that makes it possible to completely disable auto-pairs in strings, or just disable auto-balancing in strings. [Easy; requires other bits to be done first]
  • 5. Bugs
    • 1. Bad balance check for {|} { (press } at |)

Backlog (AKA stuff added during digging that isn't as important, or required to be ordered):

  • Figure out what b:autopairs_next_char_whitelist does, and document the hell outta it. See autopairs#AutoPairsInit for relevant initialization.

Notes:

1 (in general): Doing 4 before 2 and 3 due to the implications; the object rewamp forces a redesign in the core system, while at the same time being able to yeet out piles of trash like this

1.3: Part of this rewrite bit is making objects an option; aside just {"open": "close"}, something like {"open": "close", "map": "n", "delete": 1} - basically, more fine-grained control over internals. map and delete can be auto-resolved (and delete can only be allowed if close != ""). Supporting objects cannot break current pairs. Replacing bits to also support substitute() for extending functionality and the definition of allowed pairs would also make auto-pairs more powerful, though I'm not entirely sure if it's worth it.

2: Started out seeming easy, not so much. It's heavily connected with complex jump logic (AKA a black box at this point), as well as a key jiangmiao obsoleted several years ago: g:AutoPairsWildClose. Appears to be "jump out of the last pair", was moved to some bullshit mapping that would be resolved with a fucking object rather than appending some garbage to the end of the string. Substantial cleanup is required before this can be done

5.1: At least one option should be to override quote checking for single letters. Maybe make the option a map?

5.2: Should be fairly easy to extend the current options, though it might have to be made available in certain modes only.

5.3: checking highlight groups shouldn't cause too big performance problems; there's other plugins doing substantially more synchronously. Might be worth profiling to check whether it's viable or not though. Should be fine as long as it doesn't start competing with plasticboy/vim-markdown in time consumed.


There's also no due date on this, but it'll be done relatively soon. To put it like this, it'll be done before 2022, but I can't promise it'll be done in a month, because I have no idea how long it'll take to implement all the changes. My weekly workload fluctuates a lot. It's currently semi-high at the time of writing. Bugs also take priority, so if anything breaks (or has been broken all the way from the upstream repo), that will be prioritized over adding more places for there to be bugs.

@LunarWatcher
Copy link
Owner Author

The rest is moved to issue 44

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

No branches or pull requests

1 participant