I would write something like:

```ruby
ast_types = parser.environment.known_resource_types.definitions.map(&:last)
@object = ast_types.find { |ast_type| ast_type.file == file }
```

But nothing serious, just suggestion