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

Make actions (more) pure #520

Closed
3 tasks
johnfn opened this issue Jul 26, 2016 · 1 comment
Closed
3 tasks

Make actions (more) pure #520

johnfn opened this issue Jul 26, 2016 · 1 comment

Comments

@johnfn
Copy link
Member

johnfn commented Jul 26, 2016

Currently, executing an action will, if that action manipulates text, cause that action to immediately update the document. Seems logical, but it doesn't work well in the case of . and macros because they potentially can trigger hundreds of insertions and deletions.

The correct solution is to batch all updates and deletes into a single step which we send off to VSCode. However, this will requires a lot of care. VSCode does not support batching operations that operate on overlapping regions, so we'll have to accommodate for that.

Here's my game plan for this.

  • Make actions pure where possible.

Refactor every action such that inserts or deletes text to associate with itself an object that indicates what should happen to the document - { type: "insert", location: some position, text: "whatever" }

  • For some actions, make them pure eventually

For some actions like direct text insertion, we can't be sure exactly what text will be inserted into the document until we actually update vscode. (For example, if you type "(", vscode actually inserts "()". There are many cases like this, and we can't possibly account for all of them manually.)

For these actions, we'll need to associate some sort of placeholder object like { type: 'insert', text: 'i dont know yet!' } This object will get overwritten to contain the correct text once we see that vscode has updated the document.

@johnfn johnfn changed the title [Refactor] Make actions (more) pure Make actions (more) pure Jul 26, 2016
@johnfn johnfn added this to the v0.2 milestone Jul 27, 2016
@johnfn
Copy link
Member Author

johnfn commented Oct 3, 2016

I actually did this with my multi cursor mode branch. Woo

@johnfn johnfn closed this as completed Oct 3, 2016
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

1 participant