Skip to content

Commit 453fce8

Browse files
wizza-smileKronuz
authored andcommitted
allow continuous namespace completions
1 parent 20b44d2 commit 453fce8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

libs/codeintel2/lang_php.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,15 @@ def preceding_trg_from_pos(self, buf, pos, curr_pos,
585585
# Else, let's try to work out some other options
586586
accessor = buf.accessor
587587
prev_style = accessor.style_at_pos(curr_pos - 1)
588+
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+
588597
if prev_style in (self.identifier_style, self.keyword_style):
589598
# We don't know what to trigger here... could be one of:
590599
# functions:
@@ -597,7 +606,7 @@ def preceding_trg_from_pos(self, buf, pos, curr_pos,
597606
# implements apache<$><|>_getenv()...
598607
ac = AccessorCache(accessor, curr_pos)
599608
pos_before_identifer, ch, prev_style = \
600-
ac.getPrecedingPosCharStyle(prev_style)
609+
ac.getPrecedingPosCharStyle(prev_style, ignore_styles=ignore_styles)
601610
if DEBUG:
602611
print("\nphp preceding_trg_from_pos, first chance for identifer style")
603612
print(" curr_pos: %d" % (curr_pos))

0 commit comments

Comments
 (0)