So I am running a phantom example, as I am new to sublime plugin. I tried to erase the phantom by phantom.region, but it is not working, any ideas?
def open_test(self, edit):
# v = self.view
# test_view = v.window().new_file()
# v.window().set_view_index(test_view, 1, 1)
# phantoms = []
# phantoms.append(sublime.Phantom(sublime.Region(0), "100", sublime.LAYOUT_INLINE))
# self.phantom_set.update(phantoms)
phantoms = []
if self.view.size() < 2**20:
candidates = self.view.find_all('=>')
for r in candidates:
line_region = self.view.line(r.a)
line = self.view.substr(line_region)
idx = r.a - line_region.a
if idx != -1:
val = len(line[0:idx].strip())
op_pt = line_region.a + idx
phantoms.append(sublime.Phantom(sublime.Region(op_pt + 2),"test_test_test",sublime.LAYOUT_INLINE))
self.phantom_set.update(phantoms)
for phantom in phantoms:
self.view.erase(edit, phantom.region)