Skip to content

Commit

Permalink
Remove old (unused) logic related to legacy expressions (#354)
Browse files Browse the repository at this point in the history
* Remove Expr from attribute schema

* Remove Expr from semantic tokens

* Remove Expr from reference targets

* Remove Expr from reference origins

* Remove legacy expressions

* Remove Expr from references

* Remove Expr from label and attribute
  • Loading branch information
dbanck authored Jan 3, 2024
1 parent 07605a9 commit 4168ffe
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 3,789 deletions.
22 changes: 4 additions & 18 deletions decoder/attribute_candidates.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ import (
func attributeSchemaToCandidate(ctx context.Context, name string, attr *schema.AttributeSchema, rng hcl.Range) lang.Candidate {
var snippet string
var triggerSuggest bool
if attr.Constraint != nil {
cData := attr.Constraint.EmptyCompletionData(ctx, 1, 0)
snippet = fmt.Sprintf("%s = %s", name, cData.Snippet)
triggerSuggest = cData.TriggerSuggest
} else {
snippet = snippetForAttribute(name, attr)
triggerSuggest = triggerSuggestForExprConstraints(attr.Expr)
}
cData := attr.Constraint.EmptyCompletionData(ctx, 1, 0)
snippet = fmt.Sprintf("%s = %s", name, cData.Snippet)
triggerSuggest = cData.TriggerSuggest

return lang.Candidate{
Label: name,
Expand Down Expand Up @@ -55,12 +50,7 @@ func detailForAttribute(attr *schema.AttributeSchema) string {
details = append(details, "sensitive")
}

var friendlyName string
if attr.Constraint != nil {
friendlyName = attr.Constraint.FriendlyName()
} else {
friendlyName = attr.Expr.FriendlyName()
}
friendlyName := attr.Constraint.FriendlyName()

if friendlyName != "" {
details = append(details, friendlyName)
Expand All @@ -69,10 +59,6 @@ func detailForAttribute(attr *schema.AttributeSchema) string {
return strings.Join(details[:], ", ")
}

func snippetForAttribute(name string, attr *schema.AttributeSchema) string {
return fmt.Sprintf("%s = %s", name, snippetForExprContraints(1, attr.Expr))
}

func sortedObjectAttrNames(obj cty.Type) []string {
if !obj.IsObjectType() {
return []string{}
Expand Down
Loading

0 comments on commit 4168ffe

Please sign in to comment.