Skip to content

Commit

Permalink
Merge pull request #71 from rcjsuen/null-schema
Browse files Browse the repository at this point in the history
Return promises that resolve to null
  • Loading branch information
JPinkney committed Jun 1, 2018
2 parents 02eed70 + 846df4f commit 6fbc00d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/languageservice/services/jsonSchemaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ export class JSONSchemaService implements IJSONSchemaService {
return entry.getCombinedSchema(this).getResolvedSchema();
}
}
return null;
return this.promise.resolve(null);
};
if (this.customSchemaProvider) {
return this.customSchemaProvider(resource).then(schemaUri => {
Expand Down
10 changes: 10 additions & 0 deletions test/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,14 @@ suite('JSON Schema', () => {
testDone(error);
});
});

test('Null Schema', function (testDone) {
let service = new SchemaService.JSONSchemaService(requestServiceMock, workspaceContext);

service.getSchemaForResource('test.json').then((schema) => {
assert.equal(schema, null);
}).then(() => testDone(), (error) => {
testDone(error);
});
});
});

0 comments on commit 6fbc00d

Please sign in to comment.