Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep autocomplete with @pebvariable doesn't work #179

Open
ndawod opened this issue Aug 2, 2024 · 3 comments
Open

Deep autocomplete with @pebvariable doesn't work #179

ndawod opened this issue Aug 2, 2024 · 3 comments

Comments

@ndawod
Copy link

ndawod commented Aug 2, 2024

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
Copy link
Owner

bjansen commented Aug 5, 2024

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
Copy link
Author

ndawod commented Aug 5, 2024

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

@ndawod
Copy link
Author

ndawod commented Aug 8, 2024

Got a chance to look at the code? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants