diff --git a/pkg/ast/processing/find_field.go b/pkg/ast/processing/find_field.go index 3cfb681..05b9678 100644 --- a/pkg/ast/processing/find_field.go +++ b/pkg/ast/processing/find_field.go @@ -74,6 +74,9 @@ func FindRangesFromIndexList(stack *nodestack.NodeStack, indexList []string, vm if funcBody := findChildDesugaredObject(bodyNode.Body); funcBody != nil { foundDesugaredObjects = append(foundDesugaredObjects, funcBody) } + case *ast.Binary: + tmpStack := nodestack.NewNodeStack(bodyNode) + foundDesugaredObjects = FindTopLevelObjects(tmpStack, vm) case *ast.Var: varReference, err := FindVarReference(bodyNode, vm) if err != nil { diff --git a/pkg/server/completion_test.go b/pkg/server/completion_test.go index 723e7bb..515c24b 100644 --- a/pkg/server/completion_test.go +++ b/pkg/server/completion_test.go @@ -700,6 +700,15 @@ func TestCompletion(t *testing.T) { Description: "object", }, }, + { + Label: "step", + Kind: protocol.FieldCompletion, + Detail: "newjob.step", + InsertText: "step", + LabelDetails: protocol.CompletionItemLabelDetails{ + Description: "object", + }, + }, }, }, }, diff --git a/pkg/server/testdata/local_reassign.jsonnet b/pkg/server/testdata/local_reassign.jsonnet index 85bdaf2..76d7342 100644 --- a/pkg/server/testdata/local_reassign.jsonnet +++ b/pkg/server/testdata/local_reassign.jsonnet @@ -2,7 +2,10 @@ local job = { steps: { name: 'a', value: 'b' }, }; -local newjob = job; +local newjob = job + { + steps: {}, + step: super.steps, +}; { a: newjob,