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{