-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
[json] Allow users to register a json validator through code similarly to how they can register one through package.json #77433
Comments
@lexrey Can you describe a use case? |
Sure @aeschli I'd like to collect telemetry on my extension and one of the things it offers is json validation. By registering my own json validator, I could then make the telemetry function calls on use of the snippets provided by the schema as well as hovers used. |
If what you provide is a JSON schema, then all you could measure is how many accesses there are to the schema. Only the JSON language service would know when proposals or hovers are provided. -> It's already possible to provide schemas programmatically by registering a TextDocumentContentProvider To know what proposals or hovers are requested, you would have to implement a hover and completion provider. |
Could you provide an example on how to measure the amount of accesses to the schema? It seems that recreating the functionality of the jsonValidation supplied by package.json is much more difficult than recreating the snippets provided by it. |
in the TextDocumentContentProvider, serve your JSON schema when requested and collect telemetry |
Thank you for the example. And before closing just for clarification, the association for the file extensions would be set in the contributes.jsonValidation section of package.json? |
Yes, correct |
Create a function similar to registerCompletionItemProvider that can take in a json schema that provides json validation.
The text was updated successfully, but these errors were encountered: