Merge pull request #1870 from Presburger/master

fix autocomplete crash in ycmd
This commit is contained in:
Dave Halter
2022-11-11 15:50:10 +00:00
committed by GitHub
2 changed files with 4 additions and 0 deletions

View File

@@ -86,6 +86,8 @@ class StubFilter(ParserTreeFilter):
# Imports in stub files are only public if they have an "as" # Imports in stub files are only public if they have an "as"
# export. # export.
definition = name.get_definition() definition = name.get_definition()
if definition is None:
return False
if definition.type in ('import_from', 'import_name'): if definition.type in ('import_from', 'import_name'):
if name.parent.type not in ('import_as_name', 'dotted_as_name'): if name.parent.type not in ('import_as_name', 'dotted_as_name'):
return False return False

View File

@@ -78,6 +78,8 @@ class ClassName(TreeNameDefinition):
type_ = super().api_type type_ = super().api_type
if type_ == 'function': if type_ == 'function':
definition = self.tree_name.get_definition() definition = self.tree_name.get_definition()
if definition is None:
return type_
if function_is_property(definition): if function_is_property(definition):
# This essentially checks if there is an @property before # This essentially checks if there is an @property before
# the function. @property could be something different, but # the function. @property could be something different, but