def run(self, edit):
"""Standard TextCommand Run method"""
# Get the current point.
region = self.view.sel()[0]
original_point = region.begin()
point_r, point_c = self.view.rowcol(original_point)
# Figure out if any tab characters were used.
line = self.view.substr(self.view.line(original_point))
numtabs = line.count('\t')
# Get the current tab size
tabsize = util.get_vhdl_setting(self, 'tab_size')
# Create string of correct amount of dashes. A tab consumed
# one character but generates tabsize-1 space.
line = '-'*(80-point_c-(tabsize-1)*numtabs)
# Create snippet object.
snippet = line + '\n' + '-- $0' + '\n' + line + '\n'
# Inserting template/snippet
self.view.run_command("insert_snippet",
{
"contents" : snippet
})
#----------------------------------------------------------------
评论列表
文章目录