From 78d942680e0b949a005104cde0c284234cbc733b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Tue, 21 Jul 2020 17:20:10 +0200 Subject: [PATCH] Use type for getSchemaForResource parameter from superclass #204 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it requires to cast the parameter in 2 places. Signed-off-by: Aurélien Pupier --- src/languageservice/services/yamlSchemaService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/languageservice/services/yamlSchemaService.ts b/src/languageservice/services/yamlSchemaService.ts index 3d1be302b..edca6708c 100644 --- a/src/languageservice/services/yamlSchemaService.ts +++ b/src/languageservice/services/yamlSchemaService.ts @@ -17,7 +17,8 @@ import { convertSimple2RegExpPattern } from '../utils/strings'; import { TextDocument } from 'vscode-languageserver'; import { SingleYAMLDocument } from '../parser/yamlParser07'; import { stringifyObject } from '../utils/json'; -import { getNodeValue } from '../parser/jsonParser07'; +import { getNodeValue, JSONDocument } from '../parser/jsonParser07'; +import { Parser } from 'prettier'; const localize = nls.loadMessageBundle(); export declare type CustomSchemaProvider = (uri: string) => Thenable; @@ -218,7 +219,7 @@ export class YAMLSchemaService extends JSONSchemaService { } //tslint:enable - public getSchemaForResource (resource: string, doc = undefined): Thenable { + public getSchemaForResource (resource: string, doc : JSONDocument): Thenable { const resolveSchema = () => { const seen: { [schemaId: string]: boolean } = Object.create(null); const schemas: string[] = []; @@ -253,8 +254,8 @@ export class YAMLSchemaService extends JSONSchemaService { if (schemas.length > 0) { return super.createCombinedSchema(resource, schemas).getResolvedSchema().then(schema => { - if (schema.schema && schema.schema.schemaSequence && schema.schema.schemaSequence[doc.currentDocIndex]) { - return new ResolvedSchema(schema.schema.schemaSequence[doc.currentDocIndex]); + if (schema.schema && schema.schema.schemaSequence && schema.schema.schemaSequence[(doc).currentDocIndex]) { + return new ResolvedSchema(schema.schema.schemaSequence[(doc).currentDocIndex]); } return schema; });