-
-
Notifications
You must be signed in to change notification settings - Fork 84
Support delimiter insertion for "paste after" #771
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
Conversation
6b9f64f
to
d987ef5
Compare
d987ef5
to
933db4a
Compare
@@ -8,6 +8,7 @@ export type ActionType = | |||
| "copyToClipboard" | |||
| "cutToClipboard" | |||
| "deselect" | |||
| "editNew" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this so that paste and insert snippet can use it; could be useful to map a spoken form at some point 🤷. Kinda like a fancy "change" that will insert delimiters if you give it a positional modifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then maybe we should just merge this with change and allowed that option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my suggestion at meet-up, but the issue is that highlighting becomes a bit complex, as the targets will need to own a bit more. I'm not opposed to it, but maybe out of scope for this PR? We'll need to think a bit about giving targets more autonomy wrt highlighting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do that in a follow up pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we already have removal highlight range in the targets so we could just add content highlight range if we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a fairly clean solution here that would also simplify the highlight graph component, but it's worth pairing on and I think out of scope
If you prefer for this PR I can just have the paste action keep its own EditNew
object; that was my original solution
@@ -0,0 +1,82 @@ | |||
languageId: plaintext | |||
command: | |||
spokenForm: paste after line spun and after block look and before line spun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shockingly, Cursorless handled this one with no problem, inserting the right delimiters and leaving cursors in the right spot 😯
const clipboardActions: ActionType[] = context?.initialSnapshot | ||
? ["pasteFromClipboard"] | ||
: ["copyToClipboard", "cutToClipboard"]; | ||
|
||
const visibleRangeActions: ActionType[] = [ | ||
"foldRegion", | ||
"unfoldRegion", | ||
"scrollToBottom", | ||
"scrollToCenter", | ||
"scrollToTop", | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These had rotted when we upgraded action names. I added explicit types to prevent that happening in the future
Fixes #128
The main drawback here is that "paste after" inserts an extra undo stop. I think that's unavoidable until we have #559
Checklist