资源简介

javascript ,jQuery , Bootstrap 等js库的自动补全。该插件的特点就是可以自定义配置需要自动补全的库。 安装完以后它的配置文件可以配置自己需要补全的库

资源截图

代码片段和文件信息

import sublime sublime_plugin
import string


class PleasurazyAPICompletionsPackage():
  def init(self):
    self.api = {}
    self.settings = sublime.load_settings(‘sbc-setting.sublime-settings‘)
    self.API_Setup = self.settings.get(‘completion_active_list‘)

    # Caching completions
    if self.API_Setup:
      for API_Keyword in self.API_Setup:
        self.api[API_Keyword] = sublime.load_settings(‘sbc-api-‘ + API_Keyword + ‘.sublime-settings‘)

    # Caching extended completions(deprecated)
    if self.settings.get(‘completion_active_extend_list‘):
      for API_Keyword in self.settings.get(‘completion_active_extend_list‘):
        self.api[API_Keyword] = sublime.load_settings(‘sbc-api-‘ + API_Keyword + ‘.sublime-settings‘)



# In Sublime Text 3 things are loaded async using plugin_loaded() callback before try accessing.
pleasurazy = PleasurazyAPICompletionsPackage()

if int(sublime.version()) < 3000:
  pleasurazy.init()
else:
  def plugin_loaded():
    global pleasurazy
    pleasurazy.init()



class PleasurazyAPICompletionsPackageEventListener(sublime_plugin.EventListener):
  global pleasurazy

  def on_query_completions(self view prefix locations):
    self.completions = []

    for API_Keyword in pleasurazy.api:
      # If completion active
      if (pleasurazy.API_Setup and pleasurazy.API_Setup.get(API_Keyword)) or (pleasurazy.settings.get(‘completion_active_extend_list‘) and pleasurazy.settings.get(‘completion_active_extend_list‘).get(API_Keyword)):
        scope = pleasurazy.api[API_Keyword].get(‘scope‘)
        if scope and view.match_selector(locations[0] scope):
          self.completions += pleasurazy.api[API_Keyword].get(‘completions‘)

    if not self.completions:
      return []

    # extend word-completions to auto-completions
    compDefault = [view.extract_completions(prefix)]
    compDefault = [(item item) for sublist in compDefault for item in sublist if len(item) > 3]
    compDefault = list(set(compDefault))
    completions = list(self.completions)
    completions = [tuple(attr) for attr in self.completions]
    completions.extend(compDefault)
    return (completions)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-04-17 06:34  Sublime-Better-Completion-master\
     文件          28  2016-04-17 06:34  Sublime-Better-Completion-master\.gitignore
     文件        1164  2016-04-17 06:34  Sublime-Better-Completion-master\CHANGELOG.md
     文件         674  2016-04-17 06:34  Sublime-Better-Completion-master\Install_instructions.md
     文件        1440  2016-04-17 06:34  Sublime-Better-Completion-master\Main.sublime-menu
     文件        6303  2016-04-17 06:34  Sublime-Better-Completion-master\README.md
     目录           0  2016-04-17 06:34  Sublime-Better-Completion-master\README\
     文件       25136  2016-04-17 06:34  Sublime-Better-Completion-master\README\CanISwitchToSublimeText3.jpg
     目录           0  2016-04-17 06:34  Sublime-Better-Completion-master\README\HTML\
     文件      309916  2016-04-17 06:34  Sublime-Better-Completion-master\README\HTML\html-demo1.gif
     文件       49266  2016-04-17 06:34  Sublime-Better-Completion-master\README\HTML\static1.jpg
     文件       49218  2016-04-17 06:34  Sublime-Better-Completion-master\README\HTML\static2.jpg
     目录           0  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\
     文件      280505  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\demo1.gif
     文件       14124  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\static1.jpg
     文件       18284  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\static2.jpg
     文件       21361  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\static3.jpg
     文件       13407  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\static4.jpg
     文件       21985  2016-04-17 06:34  Sublime-Better-Completion-master\README\javascript-and-jQuery\static5.jpg
     文件       20841  2016-04-17 06:34  Sublime-Better-Completion-master\README\UsingPackageControl.jpg
     目录           0  2016-04-17 06:34  Sublime-Better-Completion-master\README\bootstrap-demo\
     文件      478632  2016-04-17 06:34  Sublime-Better-Completion-master\README\bootstrap-demo\demo1.gif
     文件       15415  2016-04-17 06:34  Sublime-Better-Completion-master\README\bootstrap-demo\static1.jpg
     文件       17289  2016-04-17 06:34  Sublime-Better-Completion-master\README\bootstrap-demo\static2.jpg
     文件       29793  2016-04-17 06:34  Sublime-Better-Completion-master\README\bootstrap-demo\static3.jpg
     文件       25583  2016-04-17 06:34  Sublime-Better-Completion-master\README\settings.jpg
     文件        5622  2016-04-17 06:34  Sublime-Better-Completion-master\changelog.js
     目录           0  2016-04-17 06:34  Sublime-Better-Completion-master\changelog\
     文件        1010  2016-04-17 06:34  Sublime-Better-Completion-master\changelog\1.0.0.txt
     文件         188  2016-04-17 06:34  Sublime-Better-Completion-master\changelog\1.2.0.txt
     文件         166  2016-04-17 06:34  Sublime-Better-Completion-master\changelog\1.3.0.txt
............此处省略27个文件信息

评论

共有 条评论