• 大小: 88KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-08
  • 语言: 其他
  • 标签: sublime  工具  

资源简介

这是system verilog自动补充插件

资源截图

代码片段和文件信息

import sublime sublime_plugin
import re string os sys

sys.path.append(os.path.join(os.path.dirname(__file__) ‘verilogutil‘))
import verilogutil
import sublimeutil

class VerilogAlign(sublime_plugin.TextCommand):

    def run(selfedit cmd=““):
        if len(self.view.sel())==0 : return;
        # TODO: handle multi cursor. Currently only first one ise used
        # Expand the selection to a complete scope supported by the one of the align function
        # Get sublime setting
        self.settings = self.view.settings()
        self.tab_size = int(self.settings.get(‘tab_size‘ 4))
        self.char_space = ‘ ‘ * self.tab_size
        self.use_space = self.settings.get(‘translate_tabs_to_spaces‘)
        current_pos = self.view.viewport_position()
        if not self.use_space:
            self.char_space = ‘\t‘
        # region = self.view.extract_scope(self.view.line(self.view.sel()[0]).a)
        region = self.view.sel()[0]
        region_start = region
        scope = self.view.scope_name(region.a)
        txt = ‘‘
        if cmd == ‘reindent‘:
            # Select whole text if nothing is selected
            # Otherwise expand to the line
            if region.empty():
                region = sublime.Region(0self.view.size())
            else :
                region = self.view.line(self.view.sel()[0])
            txt = self.reindent(self.view.substr(region))
        elif ‘meta.module.inst‘ in scope:
            (txtregion) = self.inst_align(region)
        elif ‘meta.module.systemverilog‘ in scope:
            (txtregion) = self.port_align(region)
        else :
            # empty region ? select all lines before and after until an empty line is found
            if region.empty():
                region = self.view.expand_by_class(regionsublime.CLASS_EMPTY_LINE)
                # TODO: maybe have a better approach stopping at a begin end and line of comment as well
            else:
                region = self.view.line(self.view.sel()[0])
            if self.view.classify(region.b) & sublime.CLASS_EMPTY_LINE :
                region.b -= 1;
            if self.view.classify(region.a) & sublime.CLASS_EMPTY_LINE :
                region.a += 1;
            txt = self.view.substr(region)
            txt = self.reindent(self.view.substr(region))
            (txtregion) = self.decl_align(txt region)
            (txtregion) = self.assign_align(txt region)
        if txt:
            self.view.replace(editregiontxt)
            sublimeutil.move_cursor(self.viewregion_start.a)
        else :
            sublime.status_message(‘No alignement support for this block of code.‘)

    def get_indent_level(selftxt):
        # make sure to not have mixed tab/space
        if self.use_space:
            t = txt.replace(‘\t‘self.char_space)
        else:
            t = txt.replace(self.char_space‘\t‘)
        cnt = (len(t) - len(t.lstrip()))
        if self.use_space:
            cnt = int(cnt/self.tab_size)
        return cnt

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         95  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\.hgignore

     文件        149  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\.hg_archival.txt

     文件        175  2015-02-01 21:38  Clams-sublimesystemverilog-c311bcfcbf26\begin-end.sublime-snippet

     文件        178  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\beginend.sublime-macro

     文件        219  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\case.sublime-snippet

     文件        239  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\class.sublime-snippet

     文件       1072  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\class_uvm.sublime-snippet

     文件        326  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\comment_box.sublime-snippet

     文件        197  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\constraint.sublime-snippet

     文件         50  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\debug\deploy_local.py

     文件        113  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\debug\undeploy_local.py

     文件        802  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\debug\util.py

     文件          0  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\debug\__init__.py

     文件       1150  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\Default.sublime-commands

     文件        200  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\Default.sublime-keymap

     文件        173  2015-02-01 21:39  Clams-sublimesystemverilog-c311bcfcbf26\else.sublime-snippet

     文件       1329  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\Find Results SV.hidden-tmLanguage

     文件        233  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\for-loop.sublime-snippet

     文件        215  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\function.sublime-snippet

     文件        200  2015-02-01 21:38  Clams-sublimesystemverilog-c311bcfcbf26\if.sublime-snippet

     文件        256  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\ifndef.sublime-snippet

     文件        219  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\interface.sublime-snippet

     文件      11301  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\LICENSE

     文件        653  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\Main.sublime-menu

     文件        259  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\messages\1.0.0.txt

     文件        382  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\messages\1.0.1.txt

     文件         98  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\messages\1.0.2.txt

     文件        250  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\messages\1.1.0.txt

     文件        295  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\messages\1.1.1.txt

     文件        269  2015-01-27 06:31  Clams-sublimesystemverilog-c311bcfcbf26\messages\1.1.2.txt

............此处省略104个文件信息

评论

共有 条评论