From f273bfa68779ffb227fa3e0649f1dad13b21f44d Mon Sep 17 00:00:00 2001 From: Tobias Guggenmos Date: Fri, 24 Jan 2020 21:43:41 +0100 Subject: [PATCH] Fix invalid version hash for vendored packages Signed-off-by: Tobias Guggenmos --- vendored/go-tools.version | 2 +- vendored/go-tools/lsp/completion_test.go | 10 +++++++--- vendored/go-tools/lsp/source/completion.go | 2 +- vendored/go-tools/lsp/source/options.go | 4 ---- vendored/go-tools/lsp/source/source_test.go | 9 ++++++--- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/vendored/go-tools.version b/vendored/go-tools.version index 43d9c25a..5f071c36 100644 --- a/vendored/go-tools.version +++ b/vendored/go-tools.version @@ -1 +1 @@ -I418463feb3e2dded191b6f1770dd7b9e44c2deca +1b668f2091859760ba5554bd33f4af390d29ee8b diff --git a/vendored/go-tools/lsp/completion_test.go b/vendored/go-tools/lsp/completion_test.go index 57232bfc..e08b813c 100644 --- a/vendored/go-tools/lsp/completion_test.go +++ b/vendored/go-tools/lsp/completion_test.go @@ -14,8 +14,14 @@ func (r *runner) Completion(t *testing.T, src span.Span, test tests.Completion, got := r.callCompletion(t, src, func(opts *source.Options) { opts.DeepCompletion = false opts.Matcher = source.CaseInsensitive - opts.Literal = strings.Contains(string(src.URI()), "literal") opts.UnimportedCompletion = false + opts.InsertTextFormat = protocol.PlainTextTextFormat + // Only enable literal completions if in the completion literals tests. + // TODO(rstambler): Separate out literal completion tests. + if strings.Contains(string(src.URI()), "literal") { + opts.InsertTextFormat = protocol.SnippetTextFormat + } + }) if !strings.Contains(string(src.URI()), "builtins") { got = tests.FilterBuiltins(got) @@ -31,7 +37,6 @@ func (r *runner) CompletionSnippet(t *testing.T, src span.Span, expected tests.C opts.Placeholders = placeholders opts.DeepCompletion = true opts.Matcher = source.Fuzzy - opts.Literal = true opts.UnimportedCompletion = false }) got := tests.FindItem(list, *items[expected.CompletionItem]) @@ -103,7 +108,6 @@ func (r *runner) RankCompletion(t *testing.T, src span.Span, test tests.Completi got := r.callCompletion(t, src, func(opts *source.Options) { opts.DeepCompletion = true opts.Matcher = source.Fuzzy - opts.Literal = true opts.UnimportedCompletion = false }) want := expected(t, test, items) diff --git a/vendored/go-tools/lsp/source/completion.go b/vendored/go-tools/lsp/source/completion.go index 4f1016c1..c6505514 100644 --- a/vendored/go-tools/lsp/source/completion.go +++ b/vendored/go-tools/lsp/source/completion.go @@ -466,7 +466,7 @@ func Completion(ctx context.Context, snapshot Snapshot, fh FileHandle, pos proto documentation: opts.CompletionDocumentation, fullDocumentation: opts.HoverKind == FullDocumentation, placeholders: opts.Placeholders, - literal: opts.Literal, + literal: opts.InsertTextFormat == protocol.SnippetTextFormat, budget: opts.CompletionBudget, }, // default to a matcher that always matches diff --git a/vendored/go-tools/lsp/source/options.go b/vendored/go-tools/lsp/source/options.go index 0edf4f26..6d5115f9 100644 --- a/vendored/go-tools/lsp/source/options.go +++ b/vendored/go-tools/lsp/source/options.go @@ -81,7 +81,6 @@ var ( DeepCompletion: true, UnimportedCompletion: true, CompletionDocumentation: true, - Literal: true, } DefaultHooks = Hooks{ ComputeEdits: myers.ComputeEdits, @@ -159,9 +158,6 @@ type UserOptions struct { // Placeholders adds placeholders to parameters and structs in completion // results. Placeholders bool - - // Literal enables completion for map, slice, and function literals. - Literal bool } type completionOptions struct { diff --git a/vendored/go-tools/lsp/source/source_test.go b/vendored/go-tools/lsp/source/source_test.go index 2ce55b44..9ef3a04b 100644 --- a/vendored/go-tools/lsp/source/source_test.go +++ b/vendored/go-tools/lsp/source/source_test.go @@ -106,9 +106,14 @@ func (r *runner) Completion(t *testing.T, src span.Span, test tests.Completion, } _, got := r.callCompletion(t, src, func(opts *source.Options) { opts.Matcher = source.CaseInsensitive - opts.Literal = strings.Contains(string(src.URI()), "literal") opts.DeepCompletion = false opts.UnimportedCompletion = false + opts.InsertTextFormat = protocol.PlainTextTextFormat + // Only enable literal completions if in the completion literals tests. + // TODO(rstambler): Separate out literal completion tests. + if strings.Contains(string(src.URI()), "literal") { + opts.InsertTextFormat = protocol.SnippetTextFormat + } }) if !strings.Contains(string(src.URI()), "builtins") { got = tests.FilterBuiltins(got) @@ -122,7 +127,6 @@ func (r *runner) CompletionSnippet(t *testing.T, src span.Span, expected tests.C _, list := r.callCompletion(t, src, func(opts *source.Options) { opts.Placeholders = placeholders opts.DeepCompletion = true - opts.Literal = true }) got := tests.FindItem(list, *items[expected.CompletionItem]) want := expected.PlainSnippet @@ -217,7 +221,6 @@ func (r *runner) RankCompletion(t *testing.T, src span.Span, test tests.Completi _, got := r.callCompletion(t, src, func(opts *source.Options) { opts.DeepCompletion = true opts.Matcher = source.Fuzzy - opts.Literal = true }) if msg := tests.CheckCompletionOrder(want, got, true); msg != "" { t.Errorf("%s: %s", src, msg)