diff --git a/jedi/inference/helpers.py b/jedi/inference/helpers.py index b0e892e6..2dffba4b 100644 --- a/jedi/inference/helpers.py +++ b/jedi/inference/helpers.py @@ -72,6 +72,10 @@ def infer_call_of_leaf(context, leaf, cut_own_trailer=False): # different trailers: `( x )`, `[ x ]` and `.x`. In the first two examples # we should not match anything more than x. if trailer.type != 'trailer' or leaf not in (trailer.children[0], trailer.children[-1]): + if leaf == ':': + # Basically happens with foo[:] when the cursor is on the colon + from jedi.inference.base_value import NO_VALUES + return NO_VALUES if trailer.type == 'atom': return context.infer_node(trailer) return context.infer_node(leaf) diff --git a/test/completion/arrays.py b/test/completion/arrays.py index 4a213289..b1785436 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -45,6 +45,9 @@ b[int():] #? list() b[:] +#? 3 +b[:] + #? int() b[:, 1] #? int()