Skip to content

Commit

Permalink
Reverse changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Apr 19, 2024
1 parent f74a22d commit a5e3ac8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/completionDecoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ export const completionDecoration = StateField.define<CompletionState>({
}
}

if (state) {
// If we ever have a state that is being updated,
// map it through the new changes to avoid the potential
// of a mismatch between it and the new document and new
// document length
return {
decorations: state.decorations.map(transaction.changes),
reverseChangeSet: state.reverseChangeSet.map(transaction.changes),
};
}

return state;
},
provide: (field) =>
Expand Down

0 comments on commit a5e3ac8

Please sign in to comment.