@@ -331,7 +331,13 @@ def trg_from_pos(self, buf, pos, implicit=True, DEBUG=False, ac=None):
331331 print ("Triggering use-namespace completion" )
332332 return Trigger (lang , TRG_FORM_CPLN , "use-namespace" ,
333333 pos , implicit )
334- elif prev_text [1 ] != "namespace" :
334+ elif prev_text [1 ] == "namespace" : #namespace completions on "namespace" keyword!
335+ if DEBUG :
336+ print ("Triggering namespace completion" )
337+ return Trigger (
338+ lang , TRG_FORM_CPLN , "namespace-members-nmspc-only" ,
339+ pos , implicit )
340+ else :
335341 if DEBUG :
336342 print ("Triggering namespace completion" )
337343 return Trigger (
@@ -586,14 +592,6 @@ def preceding_trg_from_pos(self, buf, pos, curr_pos,
586592 accessor = buf .accessor
587593 prev_style = accessor .style_at_pos (curr_pos - 1 )
588594
589- #Allow namespaces ala "common\component" to trigger class names via "functions"-trigger
590- ignore_styles = []
591- if prev_style == self .operator_style :
592- prev_char = accessor .char_at_pos (curr_pos - 1 )
593- if prev_char == "\\ " :
594- prev_style = self .identifier_style
595- ignore_styles = [self .operator_style ]
596-
597595 if prev_style in (self .identifier_style , self .keyword_style ):
598596 # We don't know what to trigger here... could be one of:
599597 # functions:
@@ -606,7 +604,7 @@ def preceding_trg_from_pos(self, buf, pos, curr_pos,
606604 # implements apache<$><|>_getenv()...
607605 ac = AccessorCache (accessor , curr_pos )
608606 pos_before_identifer , ch , prev_style = \
609- ac .getPrecedingPosCharStyle (prev_style , ignore_styles = ignore_styles )
607+ ac .getPrecedingPosCharStyle (prev_style )
610608 if DEBUG :
611609 print ("\n php preceding_trg_from_pos, first chance for identifer style" )
612610 print (" curr_pos: %d" % (curr_pos ))
@@ -776,7 +774,7 @@ def _citdl_expr_from_pos(self, trg, buf, pos, implicit=True,
776774 print ("i now: %d, ch: %r" % (i , ch ))
777775
778776 if ch in WHITESPACE :
779- if trg .type in ("use-namespace" , "namespace-members" ):
777+ if trg .type in ("use-namespace" , "namespace-members" , "namespace-members-nmspc-only" ):
780778 # Namespaces cannot be split over whitespace.
781779 break
782780 while ch in WHITESPACE :
@@ -935,8 +933,7 @@ def citdl_expr_from_trg(self, buf, trg):
935933 i = trg .extra .get ("bracket_pos" ) # triggered on foo['
936934 elif trg .type == "use" :
937935 i = trg .pos + 1
938- elif trg .type == "namespace-members" or \
939- trg .type == "use-namespace" :
936+ elif trg .type in ["namespace-members" ,"use-namespace" ,"namespace-members-nmspc-only" ]:
940937 i = trg .pos - 1
941938 else :
942939 i = trg .pos - 2 # skip past the trigger char
0 commit comments