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

Add jinja-yml support for YAML json schemas. #1073

Open
ImadYIdrissi opened this issue Dec 9, 2024 · 1 comment
Open

Add jinja-yml support for YAML json schemas. #1073

ImadYIdrissi opened this issue Dec 9, 2024 · 1 comment

Comments

@ImadYIdrissi
Copy link

Add jinja-yml support for YAML json schemas.

Autocomplete and JSON schema works correctly for YAML file association but not for Jinja-yml

Describe the solution you would like

When using this JSON schema with my YML files,

    "yaml.schemas": {
        "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_yml_files-latest.json": [
            "/**/*.yml",
            "!profiles.yml",
            "!dbt_project.yml",
            "!packages.yml",
            "!selectors.yml",
            "!profile_template.yml",
            "!package-lock.yml"
        ],
        "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_project-latest.json": [
            "dbt_project.yml"
        ],
        "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/selectors-latest.json": [
            "selectors.yml"
        ],
        "https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/packages-latest.json": [
            "packages.yml"
        ]
    },

it is correctly integrated

Image

When trying to do the same with jinja-yaml, it isn't available.
Image
Image

In fact I think it kind of crashes the extension. See this issue.

@edwardfung123
Copy link

edwardfung123 commented Jan 10, 2025

I share the exact same use case. I have to admit that it is kind of a rare use to run jinja in a yaml file...

I think the main reason it does not work is because this YAML validation extension is registered to handle one language namely yaml. But jinja-yaml is considered as another language.

Perhaps just need to add jinja-yaml to this line here.

For example:

 const clientOptions: LanguageClientOptions = {
    // Register the server for on disk and newly created YAML documents
    documentSelector: [{ language: 'yaml' }, { language: 'dockercompose' }, { language: 'jinja-yaml' }, { pattern: '*.y(a)ml' }],
    synchronize: {

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