File tree Expand file tree Collapse file tree
packages/apollo-language-server/src/schema/providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// FileSchemaProvider (FileProvider (SDL || IntrospectionResult) => schema)
22import { GraphQLSchema , buildClientSchema , Source , buildSchema } from "graphql" ;
33import { readFileSync } from "fs" ;
4- import { extname } from "path" ;
4+ import { extname , resolve } from "path" ;
55import { GraphQLSchemaProvider , SchemaChangeUnsubscribeHandler } from "./base" ;
66import { NotificationHandler } from "vscode-languageserver" ;
77
@@ -39,7 +39,8 @@ export class FileSchemaProvider implements GraphQLSchemaProvider {
3939
4040 this . schema = buildClientSchema ( { __schema } ) ;
4141 } else if ( ext === ".graphql" || ext === ".graphqls" || ext === ".gql" ) {
42- this . schema = buildSchema ( new Source ( result , path ) ) ;
42+ const uri = `file://${ resolve ( path ) } ` ;
43+ this . schema = buildSchema ( new Source ( result , uri ) ) ;
4344 }
4445 if ( ! this . schema ) throw new Error ( `Schema could not be loaded for ${ path } ` ) ;
4546 return this . schema ;
You can’t perform that action at this time.
0 commit comments