-
Notifications
You must be signed in to change notification settings - Fork 222
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
Programmatically associate YAML files with schemas by other extensions #61
Comments
You can use the "json/schemaAssociations" notification in the language server to inject the schemas https://github.com/redhat-developer/yaml-language-server/blob/master/src/server.ts#L34-L36 |
see PR for integrating custom schema providers |
The PR is merged. |
…gFix Added feature outline support from redhat-developer#24
Can you provide an example how it works? |
I try something like:
But I don't get it to work. I think the problem here is that the functions |
I found a working minimal example here: But I was not able to apply that on custom file types/languages (only directly on |
Here to request a way of specifying a schema for a YAML file programmatically by other extensions.
Scenario
When a user modifies the content of a YAML, a third party can recognize the features of the new content and tell the YAML extension what schema to use for the document.
In this way, the YAML extension can focus on generic language features but let other extensions contribute the schema knowledge.
As user types, other extensions start to recognize the contents and specifies a schema on the fly. This is super useful when a user tries to write the YAML from scratch.
Current Implementation
Currently, a user needs to specify a schema for a YAML file inside the settings.json. The users have to fill the URL of the schema and persist that association inside settings.json. When there are multiple YAML files with different schemas, this work could be time consuming and error-prone.
Proposed Implementation
Besides hard-coding the schema association, we can let other extensions contribute the logic of associating schemas with YAML files. For example, the Kubernetes extension has the manifest file schema and can tell whether a YAML file conforms to the schema. So whenever the Kubernetes extension recognizes a YAML file, it tells the YAML extension to process that YAML file with the Kubernetes schema at runtime.
The text was updated successfully, but these errors were encountered: