MCPcopy Index your code
hub / github.com/chasingboy/Xtools / run

Method run

xtools.py:300–316  ·  view source on GitHub ↗
(self, edit)

Source from the content-addressed store, hash-verified

298
299class ReplaceValueToKeyCommand(sublime_plugin.TextCommand):
300 def run(self, edit):
301 text = get_buffer_text(self.view)
302 mapstr = get_console_text(self.view).strip('\n').replace(' => ','=>').split('\n')
303 if len(mapstr) == 0:
304 sublime.message_dialog('[error] Please select input text and input mapping strings(eg: a=>b)')
305 return
306
307 for line in mapstr:
308 if '=>' in line:
309 key,values = line.split('=>')
310 values = values.split(',')
311
312 for value in values:
313 if value == '': continue
314 text = text.replace(value,key)
315
316 new_view(self.view, edit, text)
317
318
319class SortAndUniqueTextCommand(sublime_plugin.TextCommand):

Callers

nothing calls this directly

Calls 3

get_buffer_textFunction · 0.85
get_console_textFunction · 0.85
new_viewFunction · 0.85

Tested by

no test coverage detected