mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
fix #58694
This commit is contained in:
parent
7da2a63c8e
commit
1bcc3508fa
|
@ -5,7 +5,7 @@
|
|||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { URL } from 'url';
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
@ -289,7 +289,7 @@ export class ExtensionLinter {
|
|||
}
|
||||
|
||||
private addDiagnostics(diagnostics: Diagnostic[], document: TextDocument, begin: number, end: number, src: string, context: Context, info: PackageJsonInfo) {
|
||||
const uri = parseUri(src);
|
||||
const uri = parseUri(src, document.uri.toString());
|
||||
if (!uri) {
|
||||
return;
|
||||
}
|
||||
|
@ -345,14 +345,15 @@ function endsWith(haystack: string, needle: string): boolean {
|
|||
}
|
||||
}
|
||||
|
||||
function parseUri(src: string) {
|
||||
function parseUri(src: string, base?: string, retry: boolean = true) {
|
||||
try {
|
||||
return Uri.parse(src);
|
||||
let url = new URL(src, base);
|
||||
return Uri.parse(url.toString());
|
||||
} catch (err) {
|
||||
try {
|
||||
return Uri.parse(encodeURI(src));
|
||||
} catch (err) {
|
||||
if (retry) {
|
||||
return parseUri(encodeURI(src), base, false);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue