1
0
forked from VimPlug/jedi

Fix a None issue

This commit is contained in:
Dave Halter
2020-05-16 00:27:14 +02:00
parent 41c146a6f3
commit f2975f9a05

View File

@@ -343,19 +343,20 @@ class Completion:
if stack_node.nonterminal == 'funcdef': if stack_node.nonterminal == 'funcdef':
context = get_user_context(self._module_context, self._position) context = get_user_context(self._module_context, self._position)
node = search_ancestor(leaf, 'error_node', 'funcdef') node = search_ancestor(leaf, 'error_node', 'funcdef')
if node.type == 'error_node': if node is not None:
n = node.children[0] if node.type == 'error_node':
if n.type == 'decorators': n = node.children[0]
decorators = n.children if n.type == 'decorators':
elif n.type == 'decorator': decorators = n.children
decorators = [n] elif n.type == 'decorator':
decorators = [n]
else:
decorators = []
else: else:
decorators = [] decorators = node.get_decorators()
else: function_name = stack_node.nodes[1]
decorators = node.get_decorators()
function_name = stack_node.nodes[1]
return complete_param_names(context, function_name.value, decorators) return complete_param_names(context, function_name.value, decorators)
return [] return []
def _complete_keywords(self, allowed_transitions, only_values): def _complete_keywords(self, allowed_transitions, only_values):