Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Nested Object Attributes Won't Autocomplete #1336

@mattdonders

Description

@mattdonders

I have a nested object structure for managing Teams within a Game object and when trying to access attributes of that nested object, the autocomplete doesn't recommend object attributes correctly / at all..

At a high level - these are the two classes in question (code snippets).

class Game:
    def __init__(self, ...):

        self.game_id = game_id
        self.game_type = game_type
        self.date_time = date_time
        self.game_state = game_state
        self.venue = venue
        self.live_feed_endpoint = live_feed
        self.home_team = home
        self.away_team = away
        self.season = season

        # Not passed in at object creation time
        if preferred == "home":
            self.preferred_team = home
            self.other_team = away
        else:
            self.preferred_team = away
            self.other_team = home
class Team(object):
    """Holds attributes related to a team - usually two created per game."""

    def __init__(
        self, team_id, team_name, short_name, tri_code, home_away, tv_channel, games, record, season
    ):
        self.team_id = team_id
        self.team_name = team_name
        self.short_name = short_name
        self.tri_code = tri_code
        self.home_away = home_away
        self.tv_channel = tv_channel
        self.games = games
        self.record = record
        self.season = season

So as you can see each Game object holds two team objects two times - each in home / away and then in preferred / other.

Accessing the Game object in another class or function works just fine and I get all my autocompletes, but once I try to access the Team object held within the Game object I no longer get any autocomplete (screenshots below).

Screenshot 2019-07-15 16 27 17

Screenshot 2019-07-15 16 27 32

Any help would be greatly appreciated. If this is not a PLS issue I can raise it in the main vscode repository, but when using Jedi, Visual Studio doesn't even give me object attributes of the Game object so the behavior is worse.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions