Skip to content

Commit

Permalink
Use type for getSchemaForResource parameter from superclass redhat-de…
Browse files Browse the repository at this point in the history
…veloper#204

it requires to cast the parameter in 2 places.

Signed-off-by: Aurélien Pupier <[email protected]>
  • Loading branch information
apupier committed Jul 21, 2020
1 parent f21d6fc commit 78d9426
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/languageservice/services/yamlSchemaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | string[]>;
Expand Down Expand Up @@ -218,7 +219,7 @@ export class YAMLSchemaService extends JSONSchemaService {
}
//tslint:enable

public getSchemaForResource (resource: string, doc = undefined): Thenable<ResolvedSchema> {
public getSchemaForResource (resource: string, doc : JSONDocument): Thenable<ResolvedSchema> {
const resolveSchema = () => {
const seen: { [schemaId: string]: boolean } = Object.create(null);
const schemas: string[] = [];
Expand Down Expand Up @@ -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[(<SingleYAMLDocument>doc).currentDocIndex]) {
return new ResolvedSchema(schema.schema.schemaSequence[(<SingleYAMLDocument>doc).currentDocIndex]);
}
return schema;
});
Expand Down

0 comments on commit 78d9426

Please sign in to comment.