Merge branch 'main' into fix-ref-to-id
This commit is contained in:
Коммит
9d65fa79f0
|
@ -1,4 +1,9 @@
|
|||
|
||||
|
||||
4.2.0 /
|
||||
================
|
||||
* new API `LanguageService.getLanguageStatus`
|
||||
|
||||
4.1.6 / 2021-07-16
|
||||
================
|
||||
* Replace minimatch with glob-to-regexp
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vscode-json-languageservice",
|
||||
"version": "4.1.10",
|
||||
"version": "4.2.0-next.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vscode-json-languageservice",
|
||||
"version": "4.1.10",
|
||||
"version": "4.2.0-next.1",
|
||||
"description": "Language service for JSON",
|
||||
"main": "./lib/umd/jsonLanguageService.js",
|
||||
"typings": "./lib/umd/jsonLanguageService",
|
||||
|
|
|
@ -23,7 +23,7 @@ import {
|
|||
FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext,
|
||||
TextDocument,
|
||||
Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic,
|
||||
TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema
|
||||
TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema, JSONLanguageStatus
|
||||
} from './jsonLanguageTypes';
|
||||
import { findLinks } from './services/jsonLinks';
|
||||
import { DocumentLink } from 'vscode-languageserver-types';
|
||||
|
@ -41,6 +41,7 @@ export interface LanguageService {
|
|||
newJSONDocument(rootNode: ASTNode, syntaxDiagnostics?: Diagnostic[]): JSONDocument;
|
||||
resetSchema(uri: string): boolean;
|
||||
getMatchingSchemas(document: TextDocument, jsonDocument: JSONDocument, schema?: JSONSchema): Thenable<MatchingSchema[]>;
|
||||
getLanguageStatus(document: TextDocument, jsonDocument: JSONDocument): JSONLanguageStatus;
|
||||
doResolve(item: CompletionItem): Thenable<CompletionItem>;
|
||||
doComplete(document: TextDocument, position: Position, doc: JSONDocument): Thenable<CompletionList | null>;
|
||||
findDocumentSymbols(document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext): SymbolInformation[];
|
||||
|
@ -79,6 +80,7 @@ export function getLanguageService(params: LanguageServiceParams): LanguageServi
|
|||
},
|
||||
resetSchema: (uri: string) => jsonSchemaService.onResourceChange(uri),
|
||||
doValidation: jsonValidation.doValidation.bind(jsonValidation),
|
||||
getLanguageStatus: jsonValidation.getLanguageStatus.bind(jsonValidation),
|
||||
parseJSONDocument: (document: TextDocument) => parseJSON(document, { collectComments: true }),
|
||||
newJSONDocument: (root: ASTNode, diagnostics: Diagnostic[]) => newJSONDocument(root, diagnostics),
|
||||
getMatchingSchemas: jsonSchemaService.getMatchingSchemas.bind(jsonSchemaService),
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink,
|
||||
CodeActionContext, Command, CodeAction,
|
||||
DocumentHighlight, DocumentLink, WorkspaceEdit,
|
||||
TextEdit, CodeActionKind,
|
||||
TextEdit, CodeActionKind,
|
||||
TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind
|
||||
} from 'vscode-languageserver-types';
|
||||
|
||||
|
@ -33,7 +33,7 @@ export {
|
|||
SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString,
|
||||
CodeActionContext, Command, CodeAction,
|
||||
DocumentHighlight, DocumentLink, WorkspaceEdit,
|
||||
TextEdit, CodeActionKind,
|
||||
TextEdit, CodeActionKind,
|
||||
TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind
|
||||
};
|
||||
|
||||
|
@ -112,6 +112,10 @@ export interface MatchingSchema {
|
|||
schema: JSONSchema;
|
||||
}
|
||||
|
||||
export interface JSONLanguageStatus {
|
||||
schemas: string[];
|
||||
}
|
||||
|
||||
export interface LanguageSettings {
|
||||
/**
|
||||
* If set, the validator will return syntax and semantic errors.
|
||||
|
@ -158,12 +162,12 @@ export interface SchemaConfiguration {
|
|||
* The URI of the schema, which is also the identifier of the schema.
|
||||
*/
|
||||
uri: string;
|
||||
/**
|
||||
* A list of glob patterns that describe for which file URIs the JSON schema will be used.
|
||||
* '*' and '**' wildcards are supported. Exclusion patterns start with '!'.
|
||||
* For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
|
||||
* A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'.
|
||||
*/
|
||||
/**
|
||||
* A list of glob patterns that describe for which file URIs the JSON schema will be used.
|
||||
* '*' and '**' wildcards are supported. Exclusion patterns start with '!'.
|
||||
* For example '*.schema.json', 'package.json', '!foo*.schema.json', 'foo/**\/BADRESP.json'.
|
||||
* A match succeeds when there is at least one pattern matching and last matching pattern does not start with '!'.
|
||||
*/
|
||||
fileMatch?: string[];
|
||||
/**
|
||||
* The schema for the given URI.
|
||||
|
|
|
@ -23,7 +23,10 @@ const formats = {
|
|||
'date-time': { errorMessage: localize('dateTimeFormatWarning', 'String is not a RFC3339 date-time.'), pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i },
|
||||
'date': { errorMessage: localize('dateFormatWarning', 'String is not a RFC3339 date.'), pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i },
|
||||
'time': { errorMessage: localize('timeFormatWarning', 'String is not a RFC3339 time.'), pattern: /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i },
|
||||
'email': { errorMessage: localize('emailFormatWarning', 'String is not an e-mail address.'), pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ }
|
||||
'email': { errorMessage: localize('emailFormatWarning', 'String is not an e-mail address.'), pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ },
|
||||
'hostname': { errorMessage: localize('hostnameFormatWarning', 'String is not a hostname.'), pattern: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i },
|
||||
'ipv4': { errorMessage: localize('ipv4FormatWarning', 'String is not an IPv4 address.'), pattern: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/ },
|
||||
'ipv6': { errorMessage: localize('ipv6FormatWarning', 'String is not an IPv6 address.'), pattern: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i },
|
||||
};
|
||||
|
||||
export interface IProblem {
|
||||
|
@ -683,6 +686,9 @@ function validate(n: ASTNode | undefined, schema: JSONSchema, validationResult:
|
|||
case 'date':
|
||||
case 'time':
|
||||
case 'email':
|
||||
case 'hostname':
|
||||
case 'ipv4':
|
||||
case 'ipv6':
|
||||
const format = formats[schema.format];
|
||||
if (!node.value || !format.pattern.exec(node.value)) {
|
||||
validationResult.problems.push({
|
||||
|
|
|
@ -130,7 +130,6 @@ class SchemaHandle implements ISchemaHandle {
|
|||
public readonly uri: string;
|
||||
public readonly dependencies: SchemaDependencies;
|
||||
public readonly anchors: Map<string, JSONSchema>;
|
||||
|
||||
private resolvedSchema: Thenable<ResolvedSchema> | undefined;
|
||||
private unresolvedSchema: Thenable<UnresolvedSchema> | undefined;
|
||||
private readonly service: JSONSchemaService;
|
||||
|
@ -161,11 +160,13 @@ class SchemaHandle implements ISchemaHandle {
|
|||
return this.resolvedSchema;
|
||||
}
|
||||
|
||||
public clearSchema() {
|
||||
public clearSchema(): boolean {
|
||||
const hasChanges = !!this.unresolvedSchema;
|
||||
this.resolvedSchema = undefined;
|
||||
this.unresolvedSchema = undefined;
|
||||
this.dependencies.clear();
|
||||
this.anchors.clear();
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,9 +294,10 @@ export class JSONSchemaService implements IJSONSchemaService {
|
|||
if (handle.uri !== curr) {
|
||||
toWalk.push(handle.uri);
|
||||
}
|
||||
handle.clearSchema();
|
||||
if (handle.clearSchema()) {
|
||||
hasChanges = true;
|
||||
}
|
||||
all[i] = undefined;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -415,6 +417,8 @@ export class JSONSchemaService implements IJSONSchemaService {
|
|||
return this.promise.resolve(new ResolvedSchema({}, [localize('json.schema.draft03.notsupported', "Draft-03 schemas are not supported.")]));
|
||||
} else if (id === 'https://json-schema.org/draft/2019-09/schema') {
|
||||
resolveErrors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported."));
|
||||
} else if (id === 'https://json-schema.org/draft/2020-12/schema') {
|
||||
resolveErrors.push(localize('json.schema.draft202012.notsupported', "Draft 2020-12 schemas are not yet fully supported."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -639,31 +643,22 @@ export class JSONSchemaService implements IJSONSchemaService {
|
|||
return new ResolvedSchema(schema, resolveErrors);
|
||||
});
|
||||
}
|
||||
|
||||
public getSchemaForResource(resource: string, document?: Parser.JSONDocument): Thenable<ResolvedSchema | undefined> {
|
||||
|
||||
// first use $schema if present
|
||||
if (document && document.root && document.root.type === 'object') {
|
||||
const schemaProperties = document.root.properties.filter(p => (p.keyNode.value === '$schema') && p.valueNode && p.valueNode.type === 'string');
|
||||
if (schemaProperties.length > 0) {
|
||||
const valueNode = schemaProperties[0].valueNode;
|
||||
if (valueNode && valueNode.type === 'string') {
|
||||
let schemeId = <string>Parser.getNodeValue(valueNode);
|
||||
if (schemeId && Strings.startsWith(schemeId, '.') && this.contextService) {
|
||||
schemeId = this.contextService.resolveRelativePath(schemeId, resource);
|
||||
}
|
||||
if (schemeId) {
|
||||
const id = normalizeId(schemeId);
|
||||
return this.getOrAddSchemaHandle(id).getResolvedSchema();
|
||||
private getSchemaFromProperty(resource: string, document: Parser.JSONDocument): string | undefined {
|
||||
if (document.root?.type === 'object') {
|
||||
for (const p of document.root.properties) {
|
||||
if (p.keyNode.value === '$schema' && p.valueNode?.type === 'string') {
|
||||
let schemaId = p.valueNode.value;
|
||||
if (this.contextService && !/^\w[\w\d+.-]*:/.test(schemaId)) { // has scheme
|
||||
schemaId = this.contextService.resolveRelativePath(schemaId, resource);
|
||||
}
|
||||
return schemaId;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (this.cachedSchemaForResource && this.cachedSchemaForResource.resource === resource) {
|
||||
return this.cachedSchemaForResource.resolvedSchema;
|
||||
}
|
||||
|
||||
private getAssociatedSchemas(resource: string): string[] {
|
||||
const seen: { [schemaId: string]: boolean } = Object.create(null);
|
||||
const schemas: string[] = [];
|
||||
const normalizedResource = normalizeResourceForMatching(resource);
|
||||
|
@ -677,6 +672,30 @@ export class JSONSchemaService implements IJSONSchemaService {
|
|||
}
|
||||
}
|
||||
}
|
||||
return schemas;
|
||||
}
|
||||
|
||||
public getSchemaURIsForResource(resource: string, document?: Parser.JSONDocument): string[] {
|
||||
let schemeId = document && this.getSchemaFromProperty(resource, document);
|
||||
if (schemeId) {
|
||||
return [schemeId];
|
||||
}
|
||||
return this.getAssociatedSchemas(resource);
|
||||
}
|
||||
|
||||
public getSchemaForResource(resource: string, document?: Parser.JSONDocument): Thenable<ResolvedSchema | undefined> {
|
||||
if (document) {
|
||||
// first use $schema if present
|
||||
let schemeId = this.getSchemaFromProperty(resource, document);
|
||||
if (schemeId) {
|
||||
const id = normalizeId(schemeId);
|
||||
return this.getOrAddSchemaHandle(id).getResolvedSchema();
|
||||
}
|
||||
}
|
||||
if (this.cachedSchemaForResource && this.cachedSchemaForResource.resource === resource) {
|
||||
return this.cachedSchemaForResource.resolvedSchema;
|
||||
}
|
||||
const schemas = this.getAssociatedSchemas(resource);
|
||||
const resolvedSchema = schemas.length > 0 ? this.createCombinedSchema(resource, schemas).getResolvedSchema() : this.promise.resolve(undefined);
|
||||
this.cachedSchemaForResource = { resource, resolvedSchema };
|
||||
return resolvedSchema;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { JSONSchemaService, ResolvedSchema, UnresolvedSchema } from './jsonSchemaService';
|
||||
import { JSONDocument } from '../parser/jsonParser';
|
||||
|
||||
import { TextDocument, ErrorCode, PromiseConstructor, Thenable, LanguageSettings, DocumentLanguageSettings, SeverityLevel, Diagnostic, DiagnosticSeverity, Range } from '../jsonLanguageTypes';
|
||||
import { TextDocument, ErrorCode, PromiseConstructor, Thenable, LanguageSettings, DocumentLanguageSettings, SeverityLevel, Diagnostic, DiagnosticSeverity, Range, JSONLanguageStatus } from '../jsonLanguageTypes';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { JSONSchemaRef, JSONSchema } from '../jsonSchema';
|
||||
import { isBoolean } from '../utils/objects';
|
||||
|
@ -112,6 +112,10 @@ export class JSONValidation {
|
|||
return getDiagnostics(schema);
|
||||
});
|
||||
}
|
||||
|
||||
public getLanguageStatus(textDocument: TextDocument, jsonDocument: JSONDocument): JSONLanguageStatus {
|
||||
return { schemas: this.jsonSchemaService.getSchemaURIsForResource(textDocument.uri, jsonDocument) };
|
||||
}
|
||||
}
|
||||
|
||||
let idCounter = 0;
|
||||
|
|
|
@ -656,6 +656,57 @@ suite('JSON Parser', () => {
|
|||
semanticErrors = validate('{"one":"//foo/bar"}', schemaWithURIReference);
|
||||
assert.strictEqual(semanticErrors!.length, 0, 'uri-reference');
|
||||
|
||||
const schemaWithHostname = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
"hostname": {
|
||||
type: 'string',
|
||||
format: 'hostname'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
semanticErrors = validate('{"hostname":"code.visualstudio.com"}', schemaWithHostname);
|
||||
assert.strictEqual(semanticErrors!.length, 0, "hostname");
|
||||
|
||||
semanticErrors = validate('{"hostname":"foo/bar"}', schemaWithHostname);
|
||||
assert.strictEqual(semanticErrors!.length, 1, "hostname");
|
||||
assert.strictEqual(semanticErrors![0].message, 'String is not a hostname.');
|
||||
|
||||
const schemaWithIPv4 = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
"hostaddr4": {
|
||||
type: 'string',
|
||||
format: 'ipv4'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
semanticErrors = validate('{"hostaddr4":"127.0.0.1"}', schemaWithIPv4);
|
||||
assert.strictEqual(semanticErrors!.length, 0, "hostaddr4");
|
||||
|
||||
semanticErrors = validate('{"hostaddr4":"1916:0:0:0:0:F00:1:81AE"}', schemaWithIPv4);
|
||||
assert.strictEqual(semanticErrors!.length, 1, "hostaddr4");
|
||||
assert.strictEqual(semanticErrors![0].message, 'String is not an IPv4 address.');
|
||||
|
||||
const schemaWithIPv6 = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
"hostaddr6": {
|
||||
type: 'string',
|
||||
format: 'ipv6'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
semanticErrors = validate('{"hostaddr6":"1916:0:0:0:0:F00:1:81AE"}', schemaWithIPv6);
|
||||
assert.strictEqual(semanticErrors!.length, 0, "hostaddr6");
|
||||
|
||||
semanticErrors = validate('{"hostaddr6":"127.0.0.1"}', schemaWithIPv6);
|
||||
assert.strictEqual(semanticErrors!.length, 1, "hostaddr6");
|
||||
assert.strictEqual(semanticErrors![0].message, 'String is not an IPv6 address.');
|
||||
|
||||
const schemaWithEMail = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as fs from 'fs';
|
|||
import * as url from 'url';
|
||||
import * as path from 'path';
|
||||
import { getLanguageService, JSONSchema, SchemaRequestService, TextDocument, MatchingSchema } from '../jsonLanguageService';
|
||||
import { DiagnosticSeverity } from '../jsonLanguageTypes';
|
||||
import { DiagnosticSeverity, SchemaConfiguration } from '../jsonLanguageTypes';
|
||||
|
||||
function toDocument(text: string, config?: Parser.JSONDocumentConfig, uri = 'foo://bar/file.json'): { textDoc: TextDocument, jsonDoc: Parser.JSONDocument } {
|
||||
|
||||
|
@ -1831,5 +1831,57 @@ suite('JSON Schema', () => {
|
|||
}
|
||||
});
|
||||
|
||||
test('getLanguageStatus', async function () {
|
||||
const schemas: SchemaConfiguration[] = [{
|
||||
uri: 'https://myschemastore/schema1.json',
|
||||
fileMatch: ['**/*.json'],
|
||||
schema: {
|
||||
type: 'object',
|
||||
}
|
||||
},
|
||||
{
|
||||
uri: 'https://myschemastore/schema2.json',
|
||||
fileMatch: ['**/bar.json'],
|
||||
schema: {
|
||||
type: 'object',
|
||||
}
|
||||
},
|
||||
{
|
||||
uri: 'https://myschemastore/schema3.json',
|
||||
schema: {
|
||||
type: 'object',
|
||||
}
|
||||
}
|
||||
];
|
||||
const ls = getLanguageService({ workspaceContext });
|
||||
ls.configure({ schemas });
|
||||
|
||||
{
|
||||
const { textDoc, jsonDoc } = toDocument('{ }', undefined, 'foo://bar/folder/foo.json');
|
||||
const info = ls.getLanguageStatus(textDoc, jsonDoc);
|
||||
assert.deepStrictEqual(info.schemas, ['https://myschemastore/schema1.json']);
|
||||
}
|
||||
{
|
||||
const { textDoc, jsonDoc } = toDocument('{ }', undefined, 'foo://bar/folder/bar.json');
|
||||
const info = ls.getLanguageStatus(textDoc, jsonDoc);
|
||||
assert.deepStrictEqual(info.schemas, ['https://myschemastore/schema1.json', 'https://myschemastore/schema2.json']);
|
||||
}
|
||||
{
|
||||
const { textDoc, jsonDoc } = toDocument('{ $schema: "https://myschemastore/schema3.json" }', undefined, 'foo://bar/folder/bar.json');
|
||||
const info = ls.getLanguageStatus(textDoc, jsonDoc);
|
||||
assert.deepStrictEqual(info.schemas, ['https://myschemastore/schema3.json']);
|
||||
}
|
||||
{
|
||||
const { textDoc, jsonDoc } = toDocument('{ $schema: "schema3.json" }', undefined, 'foo://bar/folder/bar.json');
|
||||
const info = ls.getLanguageStatus(textDoc, jsonDoc);
|
||||
assert.deepStrictEqual(info.schemas, ['foo://bar/folder/schema3.json']);
|
||||
}
|
||||
{
|
||||
const { textDoc, jsonDoc } = toDocument('{ $schema: "./schema3.json" }', undefined, 'foo://bar/folder/bar.json');
|
||||
const info = ls.getLanguageStatus(textDoc, jsonDoc);
|
||||
assert.deepStrictEqual(info.schemas, ['foo://bar/folder/schema3.json']);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче