ryu1kn/vscode-partial-diff

View on GitHub
src/lib/commands/save-text-1.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import SelectionInfoRegistry from '../selection-info-registry';
import {TextKey} from '../const';
import {Command} from './command';
import TextEditor from '../adaptors/text-editor';

export default class SaveText1Command implements Command {
    constructor(private readonly selectionInfoRegistry: SelectionInfoRegistry) {}

    execute(editor: TextEditor) {
        const textInfo = {
            text: editor.selectedText,
            fileName: editor.fileName,
            lineRanges: editor.selectedLineRanges
        };
        this.selectionInfoRegistry.set(TextKey.REGISTER1, textInfo);
    }

}