redhat-developer / yaml-language-server

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

External lookups for value completion? #679

Open edobm opened 2 years ago

edobm commented 2 years ago

Summary

For a research project, I am trying to understand if I could use yaml-language-server to support external lookup scenarios? Given the following yaml document:

object:
  propertyA: ValueA

What I want to accomplish is to have the language server suggest allowed values based on the /object/propertyA path. The problem with this is that these values change frequently. So coding them into the schema as an enum is probably not the best solution. My idea would be to call an external service for a given path and get a list of allowed values in response.

Alternatively, I could regenerate the JSON schemas on central changes and let the language server reload them periodically via HTTP?

Any hint very appreciated!

gorkem commented 2 years ago

It is possible to modify and reload schemas. I do not have an example that uses yaml-language-server directly, but we expose this API on vscode-yaml. This file should hint what yaml-language-server requests the API corresponds with