1
0
mirror of https://github.com/golang/go synced 2024-10-01 04:08:32 -06:00
go/internal/lsp/source
Suzy Mueller caa95bb40b internal/lsp: add completions of unimported std lib pkgs
Unimported packages may be suggested as completion items. Since these
are not yet imported, they should be ranked lower than other candidates.

They also require an additional import statement to be valid, which is
provided as an AdditionalTextEdit.

Adding this import does not use astutil.AddNamedImport, to avoid
editing the current ast and work even if there are errors. Additionally,
it can be hard to determine what changes need to be made to the source
document from the ast, as astutil.AddNamedImport includes a merging
pass. Instead, the completion item simply adds another import
declaration.

Change-Id: Icbde226d843bd49ee3713cafcbd5299d51530695
Reviewed-on: https://go-review.googlesource.com/c/tools/+/190338
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-08-16 18:32:40 +00:00
..
analysis.go internal/lsp: label context cancellation errors 2019-08-15 23:24:24 +00:00
completion_format.go internal/lsp: add completions of unimported std lib pkgs 2019-08-16 18:32:40 +00:00
completion_snippet.go internal/lsp: provide deep completion candidates 2019-06-27 18:58:03 +00:00
completion.go internal/lsp: add completions of unimported std lib pkgs 2019-08-16 18:32:40 +00:00
deep_completion.go internal/lsp: don't deep complete struct field names 2019-08-13 21:38:55 +00:00
diagnostics_test.go internal/span: change URI.Filename so it just returns the filename 2019-06-10 21:39:43 +00:00
diagnostics.go internal/lsp: use protocol.Range for diagnostics instead of span.Span 2019-08-16 17:06:24 +00:00
enums.go internal/lsp: switch completion item tests to using the enum strings 2019-04-17 17:57:43 +00:00
format.go internal/lsp: add completions of unimported std lib pkgs 2019-08-16 18:32:40 +00:00
highlight.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
hover.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
identifier.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
imports_test.go internal/lsp: add completions of unimported std lib pkgs 2019-08-16 18:32:40 +00:00
imports.go internal/lsp: add completions of unimported std lib pkgs 2019-08-16 18:32:40 +00:00
references.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
rename_check.go internal/lsp: use memoize package to cache source.Packages 2019-08-13 21:41:43 +00:00
rename.go internal/lsp: return rename errors for one package only 2019-08-16 17:04:40 +00:00
signature_help.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
source_test.go internal/lsp: add completions of unimported std lib pkgs 2019-08-16 18:32:40 +00:00
suggested_fix.go go/analysis: remove +experimental build tag from suggested fixes 2019-08-08 19:51:39 +00:00
symbols.go internal/lsp: split the telemetry library out 2019-08-15 21:28:02 +00:00
util.go internal/lsp: show "do not edit" message when user opens generated file 2019-08-07 16:44:42 +00:00
view.go internal/lsp: show generated warning on didChange, not didOpen 2019-08-13 21:47:29 +00:00