1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:04:46 -07:00
go/internal/lsp/source
Muir Manders 2ef0387721 internal/lsp/source: fix unimported member completion ranking
When completing members on a type checked, unimported package, you get
fully typed members. That means you get deep completions. Because we
downrank the initial unimported package members so much, any deep
completions were dominating the rankings. For example

    context.Back<>

yielded "context.Background().Err" ranked above "context.Background".
Fix by scoring context.Background in this example as
stdScore+tinyRelevanceScore instead of just tinyRelevanceScore. I also
changed untyped candidate scores in the same way so they stay
competitive when you have both imported and unimported candidates.

The other option was to propagate the score penalty into deep
candidates, but that wasn't easy. In general I think you are better off
avoiding big score penalties because they complicate the interplay
between different kinds of candidates. Scoring needs an overhaul, but
at least we are building up our test suite in the meantime.

Change-Id: Ia5d32c057b04174229686cec6ac0542c30e186e2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/218378
Run-TryBot: Muir Manders <muir@mnd.rs>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-02-10 18:17:33 +00:00
..
comment_test.go internal/lsp: convert comments to markdown before sending to client 2019-10-04 18:35:38 +00:00
comment.go internal/lsp: convert comments to markdown before sending to client 2019-10-04 18:35:38 +00:00
completion_builtin.go internal/lsp/source: improve completion for "make()" args 2020-02-02 23:20:50 +00:00
completion_format.go internal/lsp: return context cancellation from LookupBuiltin 2020-01-27 18:55:29 +00:00
completion_keywords.go internal/lsp: sort by label after score 2019-12-30 21:11:21 +00:00
completion_labels.go internal/lsp: sort by label after score 2019-12-30 21:11:21 +00:00
completion_literal.go internal/lsp: fix crash completing recursive pointer types 2020-02-07 22:44:06 +00:00
completion_snippet.go internal/lsp: merge completion options into source.Options 2020-01-13 20:09:44 +00:00
completion.go internal/lsp/source: fix unimported member completion ranking 2020-02-10 18:17:33 +00:00
deep_completion.go internal/lsp/source: improve completion involving multiple return values 2020-02-06 05:07:08 +00:00
diagnostics.go internal/lsp: don't use overlays from the session in the snapshot 2020-02-07 19:21:16 +00:00
errors.go internal/lsp: remove the checkErrors command in internal/lsp/source 2020-01-24 21:19:55 +00:00
folding_range.go internal/lsp: eliminate source.File type and move GetFile to snapshot 2019-12-19 20:51:25 +00:00
format_test.go internal/lsp/source: trim file very carefully 2020-01-17 20:34:13 +00:00
format.go internal/lsp/source: trim file very carefully 2020-01-17 20:34:13 +00:00
highlight.go internal/lsp: add highlighting for import statement 2020-01-17 17:07:20 +00:00
hover.go internal/lsp/source: export FindFileInpackage 2020-02-07 21:55:11 +00:00
identifier.go internal/lsp: don't show links in hover for test functions 2020-02-03 21:56:10 +00:00
implementation.go internal/lsp: refactor find-references and rename 2020-01-16 06:24:15 +00:00
options.go internal/lsp/source: default to full documentation for hover 2020-02-07 21:32:44 +00:00
references.go internal/lsp: don't return references for builtins 2020-02-06 19:49:06 +00:00
rename_check.go internal/lsp: improve literal func completion candidates 2019-11-07 21:18:00 +00:00
rename.go internal/lsp: permit renaming symbols declared in other packages 2020-01-27 18:56:10 +00:00
signature_help.go internal/lsp: remove unnecessary source.SignatureInformation type 2020-02-06 19:05:38 +00:00
source_test.go internal/lsp: export DiffSymbols to avoid duplication 2020-02-06 20:09:13 +00:00
symbols.go internal/lsp/source: eliminate setKind 2020-02-07 19:42:34 +00:00
util.go internal/lsp/source: export FindFileInpackage 2020-02-07 21:55:11 +00:00
view.go internal/lsp/cache: hardcode parse modes instead of guessing them 2020-02-07 20:00:15 +00:00
workspace_symbol.go internal/lsp: add support for workspace symbol 2020-02-05 19:03:17 +00:00