From 2d698943c062cf4331c397ebae6799fe0368e59d Mon Sep 17 00:00:00 2001 From: James Pogran Date: Mon, 20 Mar 2023 09:02:10 -0400 Subject: [PATCH] more tests --- .../expr_type_declaration_completion_test.go | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/decoder/expr_type_declaration_completion_test.go b/decoder/expr_type_declaration_completion_test.go index 9a7c7932..f3c57f43 100644 --- a/decoder/expr_type_declaration_completion_test.go +++ b/decoder/expr_type_declaration_completion_test.go @@ -369,6 +369,45 @@ func TestCompletionAtPos_exprTypeDeclaration(t *testing.T) { hcl.Pos{Line: 1, Column: 12, Byte: 11}, lang.CompleteCandidates([]lang.Candidate{}), }, + { + "single-line new element inside key name with no equal sign", + map[string]*schema.AttributeSchema{ + "attr": { + Constraint: schema.TypeDeclaration{}, + }, + }, + `attr = { foo } +`, + hcl.Pos{Line: 1, Column: 11, Byte: 10}, + lang.CompleteCandidates([]lang.Candidate{}), + }, + { + "single-line new element value after equal sign", + map[string]*schema.AttributeSchema{ + "attr": { + Constraint: schema.TypeDeclaration{}, + }, + }, + `attr = { foo = } +`, + hcl.Pos{Line: 1, Column: 16, Byte: 15}, + lang.CompleteCandidates([]lang.Candidate{ + { + Label: `kw`, + Detail: "keyword", + TextEdit: lang.TextEdit{ + Range: hcl.Range{ + Filename: "test.tf", + Start: hcl.Pos{Line: 1, Column: 16, Byte: 15}, + End: hcl.Pos{Line: 1, Column: 16, Byte: 15}, + }, + NewText: `kw`, + Snippet: `kw`, + }, + Kind: lang.KeywordCandidateKind, + }, + }), + }, { "single-line object value", map[string]*schema.AttributeSchema{