pass Transaction to validFor #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "validForTransaction"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm using codemirror as a searchbox. I have two "types" of autocompletions:
kind:will give you different "kinds" of cards that you can search for.I'm using
activateOnCompletionto get completion after accepting another completion. I'm also usingvalidForto make historical completions work since they may have spaces.However, as seen in this demo video, the historical completion is "overriding" the syntactical completion because the
validForis still returningtrueeven after the initial completion was accepted. You can play with the searchbox here.This PR passes the Transaction to
validFor. Using that transaction, I can calltr.isUserEvent('input.complete')and break out ofvalidFor. I used pnpm patch to test this new behavior in a branch of my project and it works the way I want.Would it maybe make more sense to always reset existing completions when picking a completion?
Yeah, I can't think of a scenario where someone would want to keep the existing completions after accepting one of them. I tried to avoid potentially breaking behavior by making a small additive change. But if you also think it would make sense for
validForto always return false after accepting a completion, that'd work for me!I've pushed an alternative patch, which cleans up some of the state transition handling, and does not add this argument to
validFor.Pull request closed