Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions packages/apollo-language-server/src/project/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,9 @@ export abstract class GraphQLProject implements GraphQLSchemaProvider {
// Don't process files of an unsupported filetype
if (!languageId) return;

try {
const contents = readFileSync(filePath, "utf8");
const document = TextDocument.create(uri, languageId, -1, contents);
this.documentDidChange(document);
} catch (error) {
console.error(error);
}
const contents = readFileSync(filePath, "utf8");
const document = TextDocument.create(uri, languageId, -1, contents);
this.documentDidChange(document);
}

fileWasDeleted(uri: DocumentUri) {
Expand Down Expand Up @@ -233,7 +229,7 @@ export abstract class GraphQLProject implements GraphQLSchemaProvider {
if (definition.kind === Kind.OPERATION_DEFINITION && definition.name) {
if (operations[definition.name.value]) {
throw new Error(
`️️There are multiple definitions for the ${definition.name.value} operation. All operations in a project must have unique names. If generating types, only the types for the first definition found will be generated.`
`️️There are multiple definitions for the \`${definition.name.value}\` operation. Please rename or remove all operations with the duplicated name before continuing.`
);
}
operations[definition.name.value] = definition;
Expand Down