Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit 74e4986

Browse files
committed
adds ng-app module completions
1 parent 2317315 commit 74e4986

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

‎AngularJS-sublime-package.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,9 @@ def on_query_completions(self, view, prefix, locations):
393393
return ng.js_in_string_completions(prefix)
394394

395395
if(viewlocation.at_html_attribute(view, 'ng-controller', locations)):
396-
return jscompletions.controllers(ng.get_current_project_indexes())
396+
return jscompletions.get('controller', ng.get_current_project_indexes())
397+
if(viewlocation.at_html_attribute(view, 'ng-app', locations)):
398+
return jscompletions.get('module', ng.get_current_project_indexes())
397399
if(view.score_selector(_scope, ng.settings.get('filter_scope'))):
398400
return ng.filter_completions()
399401
for selector in ng.settings.get('attribute_avoided_scopes'):

‎jscompletions.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ def in_string_completions(prefix):
3939
return events + injectables
4040

4141

42-
def controllers(project_index):
42+
def get(type, project_index):
4343
all_defs = project_index.get('definitions')
44-
controllers = [(completion[0].split(': ')[1] + '\tAngularJS', completion[0].split(': ')[1]) for completion in all_defs if completion[0].startswith('controller')]
45-
return list(set(controllers))
44+
types = []
45+
for completion in all_defs:
46+
if completion[0].startswith(type):
47+
trigger = completion[0].split(': ')[1].replace('.', '_') + '\tAngularJS'
48+
result = completion[0].split(': ')[1]
49+
types.append((trigger, result))
50+
return list(set(types))

0 commit comments

Comments
 (0)