Skip to content

Commit

Permalink
Don’t store originalDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jun 12, 2024
1 parent 12ef88a commit d11f6d0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ export function acceptSuggestionCommand(view: EditorView) {
}

/**
* Rejecting a suggestion: this looks at the currently-shown suggestion
* and reverses it, clears the suggestion, and makes sure
* that we don't add that clearing transaction to history and we don't
* trigger a new suggestion because of it.
* Cycle through suggested AI completed code.
*/
export const nextSuggestionCommand: Command = (view: EditorView) => {
const { state } = view;
Expand Down
3 changes: 1 addition & 2 deletions src/completionDecoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const completionDecoration = StateField.define<CompletionState>({
update(state: CompletionState, transaction: Transaction) {
for (const effect of transaction.effects) {
if (effect.is(addSuggestions)) {
const { changeSpecs, index, originalDocument } = effect.value;
const { changeSpecs, index } = effect.value;

// NOTE: here we're adjusting the decoration range
// to refer to locations in the document _after_ we've
Expand All @@ -45,7 +45,6 @@ export const completionDecoration = StateField.define<CompletionState>({
index,
decorations,
changeSpecs,
originalDocument,
reverseChangeSet: effect.value.reverseChangeSet,
};
}
Expand Down
1 change: 1 addition & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export {
copilotIgnore,
codeiumConfig,
codeiumOtherDocumentsConfig,
nextSuggestionCommand,
type CodeiumOtherDocumentsConfig,
type CodeiumConfig,
};
Expand Down
3 changes: 1 addition & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ChangeSet, Text } from "@codemirror/state";
import type { ChangeSet } from "@codemirror/state";
import type { DecorationSet } from "@codemirror/view";

/**
Expand All @@ -7,7 +7,6 @@ import type { DecorationSet } from "@codemirror/view";
*/
export type CompletionState = null | {
index: number;
originalDocument: Text;
reverseChangeSet: ChangeSet;
changeSpecs: SimpleChangeSpec[][];
decorations: DecorationSet;
Expand Down

0 comments on commit d11f6d0

Please sign in to comment.