AngularJS Sublime Text Package === Installation Options --- * [Package Control](https://packagecontrol.io/packages/AngularJS) * [Download](https://github.com/angular-ui/AngularJS-sublime-package/archive/master.zip) this repo, rename it to 'AngularJS', and place it within your `Packages` folder. This can be found within Sublime Text at `Preferences > Browse Packages…` * Clone the repo into your `Packages` folder ` git clone git://github.com/angular-ui/AngularJS-sublime-package.git AngularJS` Recommended Settings --- Update your User Settings to the following. This setting update will automatically open the completion list for HTML attributes. You can add scopes for other preprocessor to get the list to automatically show. (this is currently a ST3 default) ```js // Controls what scopes auto complete will be triggered in) "auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin" ``` (this is currently a ST3 default, sans 'text.haml') ```js // For haml you could add "auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin, text.haml" ``` ```js // add for auto triggering controller completions within the ng-controller="" "auto_complete_triggers": [ { "characters": "ng-controller=\"*", "selector": "punctuation.definition.string" } ] ``` Keymaps --- **super+ctrl+l** If not indexed: Indexes current project; If indexed: Opens quick panel with a list of definitions to search through [command: angularjs_find] **super+ctrl+alt+l** Attempts to goto definition (project must be indexed first) [command: angularjs_go_to_definition] **super+shift+ctrl+l** Attempts to open browser to directive documentation at current cursor location [command: angularjs_go_to_documentation] >---------- > >**notice** > >The above keymaps could be used by other plugins as well, so, you my need to remap them via `Preferences > Key Bindings - User` > >To check if another plugin is using the above keymaps all you have to do is open the ST console (ctrl+\`) and write out `sublime.log_commands(True)` and that will log all the commands ran in ST. > >---------- Command Palette --- * AngularJS: Rebuild Search Index * AngularJS: Delete Cache * AngularJS: Prune Cache (removes missing files from index) * AngularJS: Look Up Definition * AngularJS: Toggle - Disable All Completions * AngularJS: Toggle - Disable Indexed Directive Completions * AngularJS: Toggle - Disable Indexed Isolate Completions * AngularJS: Toggle - Disable Built-in Directive Completions * AngularJS: Toggle - Disable Built-in Element Completions * AngularJS: Toggle - Disable JS Completions * AngularJS: Toggle - Enable data- Prefix Completion Options --- Preferences > Package Settings > AngularJS > **Completions - User** You can use the following properties to either extend or override the default completions provided. **extended_attribute_list**: []; Allows you to extend the plug-in with more attributes **angular_elements**: [*]; Default list of directives that can be used as HTML elements **filter_list**: [*]; Default list of filters **core_attribute_list**: [*]; Default list of filters [*] - Adding any of these properties to your User file will override all default values for that setting **Example** *Completions - User* ```json { "extended_attribute_list":[ ["my-directive\tMy Directives", "my-directive=\"${1:string}\"$0"], ] } ``` Checkout the default completions settings (*Preferences > Package Settings > AngularJS > Completions - Default*) to see more examples. Completion Settings --- Preferences > Package Settings > AngularJS > **Settings - User** **js_scope**: "source.js - string.quoted - comment - meta.brace.square"; Scope to return JS completions in **filter_scope**: "text.html string.quoted"; Scope to return filters in **js_prefixes**: [","]; add characters that you want to prevent completion triggers **disable_all_completions**: false, **disable_indexed_directive_completions**: false; *bare-bones completion of any directives that have been index* **disable_indexed_isolate_completions**: false; *attempts to provide isolate scope completions when a directive is used as an element* **disable_default_directive_completions**: false; **disable_default_element_completions**: false; **disable_default_js_completions**: false; **enable_data_prefix**: bool (false); *adds the 'data-' prefix to attribute completions, note that you must still type 'ng-' to get autocompletion-list* Example *Settings - User*, enable "data-" prefix ```json { "enable_data_prefix": true } ``` Indexing Options --- Preferences > Package Settings > AngularJS > **Settings - User** *(requires project to be re-indexed)* The regex that's used for look up expects the definitions to start like one of the the following examples: ```js filter('interpolate', ['version', function(version) { ... .filter('interpolate', ['version', function(version) { ... ('chained').filter('interpolate', ['version', function(version) { ... /** * If you use something other than `app` as a variable name * you will need to update the `match_expressions` setting * and change `app` to some other name. */ app.filter('interpolate', ['version', function(version) { ... angular.module('myApp', []) ``` _you can change `app` to some other name if you need to_ **match_expression**: `"((^[ \\\\t]*\\.{0}|^[ \\\\t]*{0}|angular\\.{0}|\\)\\.{0}|app\\.{0})[ ]*\\([ ]*[\"\\'])([\\w\\.\\$]*)([\"\\'])"` _if you want to match against a group of names change `app` to `(app|somethingElse|foo)` and bump the following setting to `4`_ **match_expression_group**: 3 **match_definitions**: ["controller", "directive", "module", "factory", "filter"]; Determines what type of definitions to index **excluded_dirs**: ["node_modules/"]; Global setting for excluding folders **exclude_file_suffixes**: ["min.js", "angular.js"]; exclude files via their suffix **Excluding Folders Per Project** You can exclude folders at the project level by opening your project settings file `Project > Edit Project` Example: ```json "settings": { "AngularJS": { "exclude_dirs": ["someFolder/*/lib/angular/*"] } } ``` **Including Folders Per Project** You can override the default project folders by setting the AngularJS `folders` variable within your projects settings `Project > Edit Project` Example: ```json { "folders": [ { "follow_symlinks": true, "path": "/Users/username/Projects/example" } ], "settings": { "AngularJS": { "folders": [ "/Users/username/Projects/example/ng/src", "/Users/username/Vendors/someother/lib/outside/of/project" ] } } } ``` You can use 'shell-like' wildcards within your folder paths, they're expanded via the [glob](http://docs.python.org/2/library/glob.html#glob.glob) module. Quick Panel Options --- Preferences > Package Settings > AngularJS > **Settings - User** *(Sublime Text 3 Only)* **show_file_preview**: bool(true); As you type, the current file and definition will be shown in the buffer Example *Settings - User*, hide file preview ```json { "show_file_preview": false } ``` Plug-in Details --- **Syntax File** Provides a syntax file, HTML (Angular.js), that you can set to your view which adds the HTML scope back to `