aqzhyi / Sublime-Better-Completion

手刻的浪漫 DEPRECATED, use TypeScript!
338 stars 75 forks source link
frontend sublime-text

Sublime Better Completion Package

手刻的浪漫

This package aim at provide a simpler way to build own auto-completions and avoid *.sublime-completions override word-completion wrongly in some circumstance (issue#3).

auto-completion is lightweight, easier, simpler than snippets.

This package also provide several APIs completions such as JavaScript, jQuery, Lodash, Underscore, HTML5, CSS3 and Bootstrap Classes, React.js, etc

Compatible

Should be working fine with ST2 and ST3.

2015/02

2014/08

2013/09

2013/07

Why this package?

Preview

Support APIs see Setting section.

JavaScript and jQuery 1.9

Twitter Bootstrap 2 and 3

Setting

Make your own API files that contains keyword such as html, jquery, myglossary as filename sbc-api-${filename}.sublime-settings and place them in /packages/User/.

{
  // --------------------
  // sublime-better-completions-Package (sbc package)
  // --------------------
  // API files is contains the *keyword* such as `html`, `jquery`, `myglossary` with lowercase as filename `sbc-api-${filename}.sublime-settings` place in `/packages/User/` (your own) or `/packages/${this-package}/sublime-completions/` (package build-in).
  // After you enable, disable or added new your own completions, you might need restart your Sublime Text Editor.
  //
  // Your own setting file `sbc-setting.sublime-settings` need to place in `/packages/User/` and contains all your api setting property that you want to enable.
  //
  // --------------------
  // APIs Setup
  // --------------------
  // `true` means enable it.
  // `false` means disable it.
  "completion_active_list": {
    // build-in completions
    "css-properties": false,
    "gruntjs-plugins": false,
    "html": false,
    "lodash": false,
    "javascript": false,
    "jquery": false,
    "jquery-sq": false, // Single Quote
    "php": false,
    "phpci": false,
    "sql": false,
    "twitter-bootstrap": false,
    "twitter-bootstrap-less-variables": false,
    "twitter-bootstrap3": false,
    "twitter-bootstrap3-sass-variables": false,
    "underscorejs": false,
    "react": false,

    // Your own completions?
    // ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/sbc-api-my-angularjs.sublime-settings
    "my-angularjs": false,

    // ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/sbc-api-my-glossary.sublime-settings
    "my-glossary": false,

    // ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/sbc-api-my-html.sublime-settings
    "my-html": false,

    // ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/sbc-api-my-javascript.sublime-settings
    "my-javascript": false
  }
}

After you enable, disable or added new your own completions, you might need restart your Sublime Text.

API References

Installation


Relevant issues

How to trigger completion hint when every typing?

Open file Packages/User/Preferences.sublime-settings or click Setting - User from menu. In my case, I just setup the auto_complete_triggers property as follow:

{
  "auto_complete_triggers":
  [
    {
      "characters": "qazwsxedcrfvtgbyhnujmikolpQAZWSXEDCRFVTGBYHNUJMIKOLP",
      "selector": "text, source, meta, string, punctuation, constant"
    }
  ]
}

It will active most of scope triggers and most of characters.