redhat-developer / redhat-developer/yaml-language-server

Double exclamation mark "python" variable in YAML fails in NeoVim

Open
#990 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

Hello,

Using Mkdocs with Material, the YAML file should sometimes use this:

markdown_extensions:
  - pymdownx.highlight:
      anchor_linenums: true
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format

But... NeoVim with nvim-lspconfig fails to accept the !!python tag:

image

I tried many configurations...

  • Adding tag:yaml.org,2002:python
  • Adding tag:yaml.org,2002:python/name
  • Adding !python
  • Adding !python/name
  • Adding !python/name scalar

And a dozen of others. This fails. Yamls-language-server continuously says that there is an error in the YAML file.

This is the configuration I have now, still doesn't work:

return {
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        yamlls = {
          settings = {
            yaml = {
              validate = true,
              customTags = { "!!python/name" },
            },
          },
        },
      },
    },
  },
}

Thanks if someone can help me.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the yamlls customTags setting and the YAML snippet shown in the issue, then trace how the language server parses and validates the !!python/name tag. Reproduce the diagnostic in NeoVim with nvim-lspconfig. Done means the valid tag is accepted without a YAML error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript, vim
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.