From 87ed302f29fb241b8e2e3806f79c6e1b93eb1bea Mon Sep 17 00:00:00 2001 From: Winston Liu Date: Thu, 21 Jan 2021 22:48:24 -0500 Subject: [PATCH] Switch back to vscode-uri --- package-lock.json | 20 +++++++++++++++++--- package.json | 3 ++- src/schema-contributor.ts | 10 +++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c58c0d..759d59c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5851,6 +5851,13 @@ "vscode-languageserver-types": "^3.6.1", "vscode-nls": "^3.2.1", "vscode-uri": "^1.0.3" + }, + "dependencies": { + "vscode-uri": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.8.tgz", + "integrity": "sha512-obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ==" + } } }, "vscode-jsonrpc": { @@ -5898,6 +5905,13 @@ "requires": { "vscode-languageserver-protocol": "^3.7.0", "vscode-uri": "^1.0.1" + }, + "dependencies": { + "vscode-uri": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.8.tgz", + "integrity": "sha512-obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ==" + } } }, "vscode-languageserver-protocol": { @@ -5938,9 +5952,9 @@ } }, "vscode-uri": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.6.tgz", - "integrity": "sha512-sLI2L0uGov3wKVb9EB+vIQBl9tVP90nqRvxSoJ35vI3NjxE8jfsE5DSOhWgSunHSZmKS4OCi2jrtfxK7uyp2ww==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz", + "integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA==" }, "watchpack": { "version": "1.7.2", diff --git a/package.json b/package.json index 8cd2c97..d58b8dc 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,8 @@ "underscore": "1.9.1", "uuid": "^3.3.2", "vscode-extension-telemetry": "^0.1.6", - "vscode-languageclient": "^7.0.0" + "vscode-languageclient": "^7.0.0", + "vscode-uri": "^3.0.2" }, "extensionDependencies": [ "ms-vscode.azure-account" diff --git a/src/schema-contributor.ts b/src/schema-contributor.ts index f898b34..8fcb5eb 100644 --- a/src/schema-contributor.ts +++ b/src/schema-contributor.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. *--------------------------------------------------------------------------------------------*/ -import { URL } from 'url'; +import Uri from 'vscode-uri'; interface SchemaContributorProvider { readonly requestSchema: (resource: string) => string; @@ -75,10 +75,10 @@ class SchemaContributor { */ public requestCustomSchemaContent(uri: string): string { if (uri) { - const protocol = new URL(uri).protocol.slice(0, -1); // trim the : - if (protocol && this._customSchemaContributors[protocol] && - this._customSchemaContributors[protocol].requestSchemaContent) { - return this._customSchemaContributors[protocol].requestSchemaContent(uri); + const scheme = Uri.parse(uri).scheme; + if (scheme && this._customSchemaContributors[scheme] && + this._customSchemaContributors[scheme].requestSchemaContent) { + return this._customSchemaContributors[scheme].requestSchemaContent(uri); } }