VS Code, files with both yaml and javascript, IntelliSense

Hi, do you know of a way to teach VS Code to recognize JavaScript snippets embedded in yaml, and treat the entire yaml file (or a part of it) as a JavaScript object? For example:

type: custom:button-card
variables:
  person1:
    name: Adam
    age: 23
  person2:
    name: Maria
    age: 24
custom_fields:
  some_field: |
    [[[
      const p = variables.  // <-- this should trigger IntelliSense suggestions for "person1" and "person2"
    ]]]

I’ve been getting good results defining “static” code snippets in VS Code, which give me Intellisense hints for functions contained in my custom JavaScript module. But this is different; each yaml can have different content.