const MaxDeepCompletions … type deepCompletionState … // enqueue adds a candidate to the search queue. func (s *deepCompletionState) enqueue(cand candidate) { … } // scorePenalty computes a deep candidate score penalty. A candidate is // penalized based on depth to favor shallower candidates. We also give a // slight bonus to unexported objects and a slight additional penalty to // function objects. func (s *deepCompletionState) scorePenalty(cand *candidate) float64 { … } // isHighScore returns whether score is among the top MaxDeepCompletions deep // candidate scores encountered so far. If so, it adds score to highScores, // possibly displacing an existing high score. func (s *deepCompletionState) isHighScore(score float64) bool { … } // newPath returns path from search root for an object following a given // candidate. func (s *deepCompletionState) newPath(cand candidate, obj types.Object) []types.Object { … } // deepSearch searches a candidate and its subordinate objects for completion // items if deep completion is enabled and adds the valid candidates to // completion items. func (c *completer) deepSearch(ctx context.Context, minDepth int, deadline *time.Time) { … } // addCandidate adds a completion candidate to suggestions, without searching // its members for more candidates. func (c *completer) addCandidate(ctx context.Context, cand *candidate) { … } // deepCandName produces the full candidate name including any // ancestor objects. For example, "foo.bar().baz" for candidate "baz". func deepCandName(cand *candidate) string { … } // penalty reports a score penalty for cand in the range (0, 1). // For example, a candidate is penalized if it has already been used // in another switch case statement. func (c *completer) penalty(cand *candidate) float64 { … } // objChainMatches reports whether cand combined with the surrounding // object prefix matches chain. func (c *completer) objChainMatches(cand *candidate, chain []types.Object) bool { … }