From a54fc7a1292b7da3ba1ccc1e6d6ab7ab5c750a36 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 14 Dec 2021 06:24:11 +1100 Subject: feat(lsp): improve registry completion suggestions (#13023) Resolves #10051 --- cli/schemas/registry-completions.v1.json | 84 +++++++++++++++++++++++++++++ cli/schemas/registry-completions.v2.json | 93 ++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 cli/schemas/registry-completions.v1.json create mode 100644 cli/schemas/registry-completions.v2.json (limited to 'cli/schemas') diff --git a/cli/schemas/registry-completions.v1.json b/cli/schemas/registry-completions.v1.json new file mode 100644 index 000000000..2c14d450e --- /dev/null +++ b/cli/schemas/registry-completions.v1.json @@ -0,0 +1,84 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://deno.land/x/deno/cli/schemas/registry-completions.v1.json", + "title": "Deno Registry Completion Schema", + "description": "A definition of meta data that allows a Deno language server form auto completion suggestions for modules within a module registry.", + "required": [ + "version", + "registries" + ], + "type": "object", + "properties": { + "version": { + "description": "The version of the schema document.", + "type": "integer", + "minimum": 1, + "maximum": 1, + "examples": [ + 1 + ] + }, + "registries": { + "default": [], + "description": "The registries that exist for this origin.", + "type": "array", + "items": { + "$ref": "#/definitions/registry" + } + } + }, + "definitions": { + "registry": { + "type": "object", + "required": [ + "schema", + "variables" + ], + "properties": { + "schema": { + "type": "string", + "description": "The Express-like path matching string, where a specifier in the editor will be matched against, and the variables interpolated to provide a completion suggestion.", + "examples": [ + "/:package([a-z0-9_]*)/:path*", + "/:package([a-z0-9_]*)@:version?/:path*" + ] + }, + "variables": { + "default": [], + "description": "The variables that are contained in the schema string.", + "type": "array", + "items": { + "$ref": "#/definitions/variable" + } + } + } + }, + "variable": { + "type": "object", + "required": [ + "key", + "url" + ], + "properties": { + "key": { + "type": "string", + "description": "The variable key name in the schema, which will be used to build the completion suggestions.", + "examples": [ + "package", + "version", + "path" + ] + }, + "url": { + "type": "string", + "description": "The \"endpoint\" to call to provide values to complete the specifier. This endpoint should return an array of strings. Parsed values can be substituted using ${key} syntax.", + "examples": [ + "https://example.com/api/packages", + "https://example.com/api/packages/{package}", + "https://example.com/api/packages/{package}/${{version}}" + ] + } + } + } + } +} diff --git a/cli/schemas/registry-completions.v2.json b/cli/schemas/registry-completions.v2.json new file mode 100644 index 000000000..d60859c7c --- /dev/null +++ b/cli/schemas/registry-completions.v2.json @@ -0,0 +1,93 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://deno.land/x/deno/cli/schemas/registry-completions.v2.json", + "title": "Deno Registry Completion Schema", + "description": "A definition of meta data that allows a Deno language server form auto completion suggestions for modules within a module registry.", + "required": [ + "version", + "registries" + ], + "type": "object", + "properties": { + "version": { + "description": "The version of the schema document.", + "type": "integer", + "minimum": 1, + "maximum": 2, + "examples": [ + 2 + ] + }, + "registries": { + "default": [], + "description": "The registries that exist for this origin.", + "type": "array", + "items": { + "$ref": "#/definitions/registry" + } + } + }, + "definitions": { + "registry": { + "type": "object", + "required": [ + "schema", + "variables" + ], + "properties": { + "schema": { + "type": "string", + "description": "The Express-like path matching string, where a specifier in the editor will be matched against, and the variables interpolated to provide a completion suggestion.", + "examples": [ + "/:package([a-z0-9_]*)/:path*", + "/:package([a-z0-9_]*)@:version?/:path*" + ] + }, + "variables": { + "default": [], + "description": "The variables that are contained in the schema string.", + "type": "array", + "items": { + "$ref": "#/definitions/variable" + } + } + } + }, + "variable": { + "type": "object", + "required": [ + "key", + "url" + ], + "properties": { + "key": { + "type": "string", + "description": "The variable key name in the schema, which will be used to build the completion suggestions.", + "examples": [ + "package", + "version", + "path" + ] + }, + "documentation": { + "type": "string", + "description": "An optional \"endpoint\" to call to provide documentation for specified variable, which can be displayed to the client in the response. This can provide description information about the item. The value should contain the variable name in the template. Baseless URLs can be supplied and the host for the configuration file will be used as the base.", + "examples": [ + "https://example.com/api/documentation/packages/${package}/${{version}}/${path}", + "/api/documentation/packages/${package}/${{version}}/${path}" + ] + }, + "url": { + "type": "string", + "description": "The \"endpoint\" to call to provide values to complete the specifier. This endpoint should return an array of strings. Parsed values can be substituted using ${key} syntax. In order to support incremental completions, the value should contain the variable name in the template. Baseless URLs can be supplied and the host for the configuration file will be used as the base.", + "examples": [ + "https://example.com/api/packages", + "https://example.com/api/packages/${package}", + "https://example.com/api/packages/${package}/${{version}}", + "/api/packages/${package}/${{version}}/${path}" + ] + } + } + } + } +} -- cgit v1.2.3