bjansen / pebble-intellij

Pebble support for IntelliJ IDEA
MIT License
89 stars 8 forks source link

Deep autocomplete with `@pebvariable` doesn't work #179

Open ndawod opened 1 month ago

ndawod commented 1 month ago

I have many models which contain other models, for example (Kotlin code):

data class Car(
  val name: String,
  val doors: Int
)

data class Park(
  address: String,
  cars: List<Car>,
)

data class TemplateModel(
  val park: Park
)

In the following Pebble template, autocomplete and Ctrl+Click (Command+Click on Mac) works for only the immediate descendent properties of model.*:

{# @pebvariable name="model" type="com.example.TemplateModel" #}

Park details:

Address: {{ model.park.address }}
Cars count: {{ model.park.count.size }}

As someone who's migrating from FreeMarker to Pebble, this is so much a needed feature (which works fine in FreeMarker but not in Pebble).

Am I doing something wrong? Or is this feature missing in the current implementation?

bjansen commented 1 month ago

Hi,

It should work, maybe I missed something for Kotlin data classes, but ctrl-click on an equivalent Java model works (at least it worked when I implemented it :)). I'll look into it.

ndawod commented 1 month ago

AFAIK, data models are a Kotlin thing, unsure if Java has them? Anyway, thanks for looking into it!

ndawod commented 1 month ago

Got a chance to look at the code? :)