Skip to content

Commit

Permalink
a few bugfixes related to config handling impacting vim and potential…
Browse files Browse the repository at this point in the history
…ly other users
  • Loading branch information
acao committed Apr 2, 2022
1 parent e793f88 commit efd4595
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-bobcats-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphql-language-service-server': patch
---

a few bugfixes related to config handling impacting vim and potentially other LSP server users
10 changes: 5 additions & 5 deletions packages/graphql-language-service-server/src/MessageProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ export class MessageProcessor {
const rootDir = this._settings?.load?.rootDir || this._rootPath;
this._rootPath = rootDir;
this._loadConfigOptions = {
...Object.keys(this._settings.load || []).reduce((agg, key) => {
const value = this._settings.load[key];
...Object.keys(this._settings?.load || []).reduce((agg, key) => {
const value = this._settings?.load[key];
if (value === undefined || value === null) {
delete agg[key];
}
return agg;
}, this._settings.load),
}, this._settings.load ?? {}),
rootDir,
};
// reload the graphql cache
Expand Down Expand Up @@ -288,7 +288,7 @@ export class MessageProcessor {
'graphql.config',
'graphqlrc',
'package.json',
this._settings.load.fileName,
this._settings.load?.fileName,
].filter(Boolean);
if (configMatchers.some(v => uri.match(v)?.length)) {
this._logger.info('updating graphql config');
Expand Down Expand Up @@ -404,7 +404,7 @@ export class MessageProcessor {
return { uri, diagnostics };
}
async handleDidChangeConfiguration(
_params?: DidChangeConfigurationParams,
_params: DidChangeConfigurationParams,
): Promise<DidChangeConfigurationRegistrationOptions> {
await this._updateGraphQLConfig();
this._logger.log(
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql-language-service-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
DidOpenTextDocumentNotification,
DidSaveTextDocumentNotification,
DidChangeTextDocumentNotification,
DidChangeConfigurationNotification,
DidCloseTextDocumentNotification,
ExitNotification,
HoverRequest,
Expand Down Expand Up @@ -366,7 +367,7 @@ async function addHandlers({
messageProcessor.handleWorkspaceSymbolRequest(params),
);

connection.onDidChangeConfiguration(
messageProcessor.handleDidChangeConfiguration,
connection.onNotification(DidChangeConfigurationNotification.type, params =>
messageProcessor.handleDidChangeConfiguration(params),
);
}

0 comments on commit efd4595

Please sign in to comment.