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

customTags for yaml-language-server #716

Open
alexvoss opened this issue Jan 5, 2024 · 2 comments
Open

customTags for yaml-language-server #716

alexvoss opened this issue Jan 5, 2024 · 2 comments

Comments

@alexvoss
Copy link

alexvoss commented Jan 5, 2024

Hi,

I am looking for a way to define customTags for yaml-language-server. I am editing ~/.local/share/vim-lsp-settings/settings.json and have:

{
  "yaml-language-server": {
    "schemas": [
      {
        "fileMatch": ["mkdocs.yaml", "mkdocs.yml"],
        "url": "file:///Users/avoss/src/mkdocs-material/mkdocs-material-fork/docs/schema.json"
      }
    ],
    "customTags": [
      "!ENV scalar",
      "!ENV sequence",
      "tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
      "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji"
    ]
  }     
}

The schemas part comes from vim-lsp-settings.txt in the help. I assumed that I could add the customTags attribute in the same way but it does not seem to have any effect. The tags I am trying to define come from Material for MkDocs.

What confuses me is that the format for the schema configuration is different from that shown in the documentation for the language server? Is there even a way to configure customTags in the global settings?

@Andrwe
Copy link

Andrwe commented Jan 22, 2024

For me setting the following in my vimrc worked:

let g:lsp_settings = {     
\   "yaml-language-server": { 
\     "workspace_config": {         
\       "yaml": {                 
\         "customTags": [                
\           "!reference sequence"
\         ]                             
\       }                                                                                                             
\     }
\   }                                                                                                                 
\ }

Based on that I assume, you need to move customTags into workspace_config>yaml, e.g.:

{
  "yaml-language-server": {
    "schemas": [
      {
        "fileMatch": ["mkdocs.yaml", "mkdocs.yml"],
        "url": "file:///Users/avoss/src/mkdocs-material/mkdocs-material-fork/docs/schema.json"
      }
    ],
    "workspace_config": {
      "yaml": {
        "customTags": [
          "!ENV scalar",
          "!ENV sequence",
          "tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
          "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji"
        ]
      }
    }
  }
}

@alexvoss
Copy link
Author

Thanks, that did the trick!

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