-
Notifications
You must be signed in to change notification settings - Fork 11
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
Allow specification of jsonschema via modeline #12
Comments
I don't know where the output of console.log is going so I don't know if my hacked code is getting executed. I do know which key of editor.options to set to specify the json schema for this particular window. I added a branch to recognize schema and then tried to update the '$schema' key of editor.options but without being able to see the logging output, I don't think I will be able to make any progress.
|
I got the logging working (by creating the output channel (based on https://stackoverflow.com/a/58139566/40387 ) in the activate function and then passing it in to all of the closures that call applyModeLines) and I saw that editor.options does not appear to have any key directly relating to schemas. I will take a look at the Red Hat YAML extension (which supports modelines for YAML files) and see if I can figure out how it does it. Also, it may work out nicer for my users to edit their files in YAML and have them auto-converted to JSON as needed. In any case, this is a very cool extension! It is short and simple enough that a newbie like myself can figure out how to modify it. |
I suspect there is no schema property on editor.options because schemas are specific to data languages like json/yaml. If you figure out how to do it you can submit a PR. You will have to make sure the |
It would be awesome if one could specify the jsonschema of a file via a modeline. I have a lot of schemata for JSON and YAML fles
the YAML extension supports this via:
# yaml-language-server: $schema=<urlToTheSchema>
I would like to be able to do it similarly for blobs of JSON
// code: language=javascript insertSpaces=true tabSize=4 $schema=https://json.schemastore.org/foobar
I assume that this is a straightforward addition to the parser? I have no experience with truescript nor with vs code extensions so I assume learning the packaging and deployment process would be a lot more effort than writing the code? In any case, I am not all that confident of being able to do it myself although I will probably give it a try if there is no activity on this ticket.
Thanks in advance for any advice/code.
The text was updated successfully, but these errors were encountered: