Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/ast_processing/find_position.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func FindNodeByPosition(node ast.Node, location ast.Location) (*nodestack.NodeSt
funcBody.LocRange = field.LocRange
stack.Push(funcBody)
} else {
stack.Push(field.Name)
stack.Push(body)
}
}
Expand Down
16 changes: 16 additions & 0 deletions pkg/server/definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,22 @@ var definitionTestCases = []definitionTestCase{
},
}},
},
{
name: "goto computed field name object field",
filename: "testdata/goto-computed-field-names.jsonnet",
position: protocol.Position{Line: 3, Character: 9},
results: []definitionResult{{
targetFilename: "testdata/goto-computed-field-names.jsonnet",
targetRange: protocol.Range{
Start: protocol.Position{Line: 0, Character: 14},
End: protocol.Position{Line: 0, Character: 26},
},
targetSelectionRange: protocol.Range{
Start: protocol.Position{Line: 0, Character: 14},
End: protocol.Position{Line: 0, Character: 17},
},
}},
},
}

func TestDefinition(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions pkg/server/testdata/goto-computed-field-names.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
local obj = { bar: 'hello' };

{
[obj.bar]: 'world!',
}