@@ -39,19 +39,19 @@ def active_view(self):
39
39
return self .active_window ().active_view ()
40
40
41
41
def get_folders (self ):
42
- return ng .view_settings ().get ('folders' , ng .active_window ().folders ())
42
+ return self .view_settings ().get ('folders' , self .active_window ().folders ())
43
43
44
44
def get_index_key (self ):
45
- return "" .join (ng .get_folders ())
45
+ return "" .join (self .get_folders ())
46
46
47
47
def get_project_indexes_at (self , index_key ):
48
48
return self .projects_index_cache [index_key ]['definitions' ]
49
49
50
50
def exclude_dirs (self ):
51
51
exclude_dirs = []
52
- for folder in ng .get_folders ():
53
- exclude_dirs += [glob .glob (folder + "/" + path ) for path in ng .settings .get ('exclude_dirs' , [])]
54
- exclude_dirs += [glob .glob (folder + "/" + path ) for path in ng .view_settings ().get ('exclude_dirs' , [])]
52
+ for folder in self .get_folders ():
53
+ exclude_dirs += [glob .glob (folder + "/" + path ) for path in self .settings .get ('exclude_dirs' , [])]
54
+ exclude_dirs += [glob .glob (folder + "/" + path ) for path in self .view_settings ().get ('exclude_dirs' , [])]
55
55
return list (itertools .chain (* exclude_dirs ))
56
56
57
57
def get_current_project_indexes (self ):
@@ -241,7 +241,7 @@ def completions(self, view, prefix, locations, is_inside_tag):
241
241
ch = view .substr (sublime .Region (pt , pt + 1 ))
242
242
243
243
if (ch != '<'
244
- and not ng .settings .get ('disable_default_directive_completions' )): attrs = self .attributes [:]
244
+ and not self .settings .get ('disable_default_directive_completions' )): attrs = self .attributes [:]
245
245
else : attrs = []
246
246
attrs += self .get_isolate_completions (view , prefix , locations , pt )
247
247
attrs += self .add_indexed_directives ()
@@ -251,13 +251,13 @@ def completions(self, view, prefix, locations, is_inside_tag):
251
251
return (attrs , 0 )
252
252
253
253
if not is_inside_tag :
254
- if not ng .isST2 and ng .isSource ('text.html' ):
254
+ if not self .isST2 and self .isSource ('text.html' ):
255
255
if (view .substr (view .sel ()[0 ].b - 1 ) == '<' ): return []
256
- if ng .isST2 and ng .isSource ('text.html' ):
256
+ if self .isST2 and self .isSource ('text.html' ):
257
257
if (view .substr (view .sel ()[0 ].b - 1 ) != '<' ): return []
258
258
in_scope = False
259
259
260
- for scope in ng .settings .get ('component_defined_scopes' ):
260
+ for scope in self .settings .get ('component_defined_scopes' ):
261
261
if view .match_selector (locations [0 ], scope ):
262
262
in_scope = True
263
263
@@ -267,16 +267,16 @@ def completions(self, view, prefix, locations, is_inside_tag):
267
267
completions += [
268
268
(directive [0 ], self .convertIndexedDirectiveToTag (directive [1 ])) for directive in self .add_indexed_directives ()
269
269
]
270
- if not ng .settings .get ('disable_default_element_completions' ):
271
- elems = [tuple (element ) for element in list (ng .settings_completions .get ('angular_elements' , []))]
270
+ if not self .settings .get ('disable_default_element_completions' ):
271
+ elems = [tuple (element ) for element in list (self .settings_completions .get ('angular_elements' , []))]
272
272
elems = self .convertElementToSourceType (elems )
273
273
completions += elems
274
274
return (completions , 0 )
275
275
else :
276
276
return []
277
277
278
278
def get_isolate_completions (self , view , prefix , locations , pt ):
279
- if ng .settings .get ('disable_indexed_isolate_completions' ): return []
279
+ if self .settings .get ('disable_indexed_isolate_completions' ): return []
280
280
281
281
# pulled lots from html_completions.py
282
282
SEARCH_LIMIT = 500
@@ -313,13 +313,13 @@ def get_isolate_completions(self, view, prefix, locations, pt):
313
313
return []
314
314
315
315
def filter_completions (self ):
316
- current_point = ng .active_view ().sel ()[0 ].end ()
317
- previous_text_block = ng .active_view ().substr (sublime .Region (current_point - 2 ,current_point ))
316
+ current_point = self .active_view ().sel ()[0 ].end ()
317
+ previous_text_block = self .active_view ().substr (sublime .Region (current_point - 2 ,current_point ))
318
318
if (previous_text_block == '| ' ):
319
- filter_list = ng .get_current_project_indexes ().get ('definitions' )
319
+ filter_list = self .get_current_project_indexes ().get ('definitions' )
320
320
filter_list = [(i [0 ], i [0 ][9 :]) for i in filter_list if i [0 ][:6 ] == 'filter' ]
321
321
filter_list = list (set (filter_list )) #attempt to remove duplicates
322
- filter_list += [tuple (completion ) for completion in ng .settings_completions .get ('filter_list' , [])]
322
+ filter_list += [tuple (completion ) for completion in self .settings_completions .get ('filter_list' , [])]
323
323
return (filter_list )
324
324
else :
325
325
return []
@@ -329,21 +329,21 @@ def js_completions(self):
329
329
# https://github.com/angular-ui/AngularJS-sublime-package/issues/14
330
330
current_word_separators = r'./\\()\"\'-:,.;<>~!@#%^&*|+=[]{}`~?'
331
331
def st_hack ():
332
- ng .active_view ().settings ().set ('word_separators' , current_word_separators )
332
+ self .active_view ().settings ().set ('word_separators' , current_word_separators )
333
333
334
334
if self .settings .get ('disable_default_js_completions' ): return []
335
335
else :
336
336
# ugly hack to fix ST bug
337
- ng .active_view ().settings ().set ('word_separators' , "/\()\" '-:,;<>~!@#%^&*|+=[]{}`~?" )
337
+ self .active_view ().settings ().set ('word_separators' , "/\()\" '-:,;<>~!@#%^&*|+=[]{}`~?" )
338
338
completions = [tuple (completion ) for completion in list (self .settings_js_completions .get ('js_completions' , []))]
339
339
sublime .set_timeout (st_hack , 300 )
340
340
return completions
341
341
342
342
def add_indexed_directives (self ):
343
- if ng .settings .get ('disable_indexed_directive_completions' ): return []
343
+ if self .settings .get ('disable_indexed_directive_completions' ): return []
344
344
345
345
try :
346
- indexes = ng .get_current_project_indexes ().get ('definitions' )
346
+ indexes = self .get_current_project_indexes ().get ('definitions' )
347
347
except :
348
348
return []
349
349
@@ -359,22 +359,22 @@ def definitionToDirective(self, directive):
359
359
return re .sub ('([a-z0-9])([A-Z])' , r'\1-\2' , directive [0 ].replace ('directive: ' , '' )).lower ()
360
360
361
361
def process_attributes (self ):
362
- add_data_prefix = ng .settings .get ('enable_data_prefix' )
362
+ add_data_prefix = self .settings .get ('enable_data_prefix' )
363
363
364
- for attr in ng .settings_completions .get ('core_attribute_list' ):
364
+ for attr in self .settings_completions .get ('core_attribute_list' ):
365
365
if add_data_prefix :
366
366
attr [1 ] = "data-" + attr [1 ]
367
367
368
368
self .attributes .append (attr )
369
369
370
- for attr in ng .settings_completions .get ('extended_attribute_list' ):
370
+ for attr in self .settings_completions .get ('extended_attribute_list' ):
371
371
if add_data_prefix :
372
372
attr [1 ] = "data-" + attr [1 ]
373
373
374
374
self .attributes .append (attr )
375
375
376
- if ng .settings .get ('enable_AngularUI_directives' ):
377
- for attr in ng .settings_completions .get ('AngularUI_attribute_list' ):
376
+ if self .settings .get ('enable_AngularUI_directives' ):
377
+ for attr in self .settings_completions .get ('AngularUI_attribute_list' ):
378
378
if add_data_prefix :
379
379
attr [1 ] = 'data-' + attr [1 ]
380
380
0 commit comments