mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
Feature request - subtype support for member predicates #133
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bvalyou on GitHub (Apr 5, 2024).
I'm working on migrating helm charts to Pkl and the way I've structured my shared code leverages a
Listing<K8sResource>(pkl-k8s) that various pipe functions amend to add features, e.g. a database pipeline adds database env vars, ConfigMaps, and initContainers.Summary
Quick pseudocode to show the general idea:
This works, but the
Deploymentobject I'm amending doesn't know it's aDeploymentobject, so my IDE can only autocomplete theK8sResourceattributesapiVersionandkind.Requested feature
Subtype syntax -
[[is Deployment]] {}or[[kind == "Deployment"] as Deployment] {}where the subtype is known in the following amend block.It's definitely workable as is but it would be a nice quality of life enhancement.
Thanks for the great work on this!
@odenix commented on GitHub (Apr 5, 2024):
Does
[[this is Deployment]]do the trick?@bvalyou commented on GitHub (Apr 5, 2024):
The one syntax variation I didn't think of! That does it. Thanks!
@odenix commented on GitHub (Apr 5, 2024):
Is it also understood by the IDE?
@bvalyou commented on GitHub (Apr 5, 2024):
Mostly, though I am seeing a gap within the predicate itself
On that line there's a warning "Unresolved reference: metadata" but on the next line it autocompletes fine
@odenix commented on GitHub (Apr 5, 2024):
Probably worth filing an issue in pkl-intellij.