redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.07k stars 260 forks source link

Getting customTags to work #797

Closed tim3trick closed 1 year ago

tim3trick commented 1 year ago

Summary

I have nvim (astrovim) set up and running and am currently trying to work on some partial gitlab-ci yaml file. Currently I get the error "Unresolved tag !reference".

Relevant information

Here is the content of the file in question:

# yaml-language-server $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
feature:build:
  stage: build
  variables:
    DOCKER_TAG: $CI_COMMIT_REF_SLUG
  script:
    - !reference [".deploy", script]

!reference is a valid custom tag for gitlab-ci

This is my current yamlls configuration (init.lua):

      yamlls = {
        settings = {
          yaml = {
            schemastore = {
              enable = true,
            },
            customTags = {
              "!reference scalar",
            },
          },
        },
      },

I tried various versions, including

If i disable validation via

        settings = {
          yaml = {
            validate = false,

The error is gone, so I suspect that the configuration is passed to yamlls.

Can someone help me out?

gorkem commented 1 year ago

Adding the following snippet to my settings.json seemed to do the trick for me

"yaml.customTags": [
    "!reference sequence",
  ],
gorkem commented 1 year ago

Closing due to inactivity

halshar commented 5 months ago

Adding the following snippet to my settings.json seemed to do the trick for me

"yaml.customTags": [
    "!reference sequence",
  ],

tried this and other variants(!reference scalar, !reference mapping, !reference sequence and just !reference) as well but nothing seems to be working

using nvim v0.9.5 and yaml-language-server v1.14.0