From 904c27c6d5f609a1a61ccc46bcc71d406b3dd277 Mon Sep 17 00:00:00 2001 From: cschen Date: Tue, 19 Nov 2024 19:46:44 +0100 Subject: [PATCH] feat: Add sync command. --- Codemp.sublime-commands | 5 +++++ main.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Codemp.sublime-commands b/Codemp.sublime-commands index d523fb2..c2c3e53 100644 --- a/Codemp.sublime-commands +++ b/Codemp.sublime-commands @@ -116,4 +116,9 @@ // 'buffer_id': 'test' } }, + { + "caption": "Codemp: Sync", + "command": "codemp_sync_buffer", + "args": {} + } ] \ No newline at end of file diff --git a/main.py b/main.py index d35d828..86ad0a9 100644 --- a/main.py +++ b/main.py @@ -100,6 +100,12 @@ class CodempReplaceTextCommand(sublime_plugin.TextCommand): self.view.replace(edit, region, content) +class CodempSyncBuffer(sublime_plugin.TextCommand): + def run(self, edit): + buff = buffers.lookupId(self.view.settings().get(g.CODEMP_BUFFER_ID)) + buff.sync(TEXT_LISTENER) + + class EventListener(sublime_plugin.EventListener): def is_enabled(self): return session.is_active()