From b378173fb4993f10f7ef8835da63b9a7168c52de 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 b467cf9..ac813da 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()