Skip to content

Commit d094b02

Browse files
renovate[bot]renovate-bottrevor-scheer
authored
chore(deps): update dependency vscode-languageserver to v7 (#2607)
* chore(deps): update dependency vscode-languageserver to v7 * Update for breaking changes * lint Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Trevor Scheer <[email protected]>
1 parent fb8d043 commit d094b02

File tree

5 files changed

+64
-51
lines changed

5 files changed

+64
-51
lines changed

package-lock.json

Lines changed: 44 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/apollo-language-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"lodash.debounce": "^4.0.8",
4040
"lodash.merge": "^4.6.1",
4141
"minimatch": "^5.0.0",
42-
"vscode-languageserver": "^5.1.0",
42+
"vscode-languageserver": "^7.0.0",
43+
"vscode-languageserver-textdocument": "^1.0.4",
4344
"vscode-uri": "1.0.6"
4445
},
4546
"jest": {

packages/apollo-language-server/src/loadingHandler.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IConnection, NotificationType } from "vscode-languageserver";
1+
import { Connection, NotificationType } from "vscode-languageserver";
22

33
// XXX I think we want to combine this into an interface
44
// with the errors tooling as well
@@ -10,25 +10,25 @@ export interface LoadingHandler {
1010
}
1111

1212
export class LanguageServerLoadingHandler implements LoadingHandler {
13-
constructor(private connection: IConnection) {}
13+
constructor(private connection: Connection) {}
1414
private latestLoadingToken = 0;
1515
async handle<T>(message: string, value: Promise<T>): Promise<T> {
1616
const token = this.latestLoadingToken;
1717
this.latestLoadingToken += 1;
1818
this.connection.sendNotification(
19-
new NotificationType<any, void>("apollographql/loading"),
19+
new NotificationType<any>("apollographql/loading"),
2020
{ message, token }
2121
);
2222
try {
2323
const ret = await value;
2424
this.connection.sendNotification(
25-
new NotificationType<any, void>("apollographql/loadingComplete"),
25+
new NotificationType<any>("apollographql/loadingComplete"),
2626
token
2727
);
2828
return ret;
2929
} catch (e) {
3030
this.connection.sendNotification(
31-
new NotificationType<any, void>("apollographql/loadingComplete"),
31+
new NotificationType<any>("apollographql/loadingComplete"),
3232
token
3333
);
3434
this.showError(`Error in "${message}": ${e}`);
@@ -39,19 +39,19 @@ export class LanguageServerLoadingHandler implements LoadingHandler {
3939
const token = this.latestLoadingToken;
4040
this.latestLoadingToken += 1;
4141
this.connection.sendNotification(
42-
new NotificationType<any, void>("apollographql/loading"),
42+
new NotificationType<any>("apollographql/loading"),
4343
{ message, token }
4444
);
4545
try {
4646
const ret = value();
4747
this.connection.sendNotification(
48-
new NotificationType<any, void>("apollographql/loadingComplete"),
48+
new NotificationType<any>("apollographql/loadingComplete"),
4949
token
5050
);
5151
return ret;
5252
} catch (e) {
5353
this.connection.sendNotification(
54-
new NotificationType<any, void>("apollographql/loadingComplete"),
54+
new NotificationType<any>("apollographql/loadingComplete"),
5555
token
5656
);
5757
this.showError(`Error in "${message}": ${e}`);

packages/apollo-language-server/src/server.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import "apollo-env/lib/fetch/global";
44
import {
55
createConnection,
66
ProposedFeatures,
7-
TextDocuments,
87
FileChangeType,
9-
ServerCapabilities
10-
} from "vscode-languageserver";
8+
ServerCapabilities,
9+
TextDocuments,
10+
TextDocumentSyncKind
11+
} from "vscode-languageserver/node";
12+
import { TextDocument } from "vscode-languageserver-textdocument";
1113
import { QuickPickItem } from "vscode";
1214
import { GraphQLWorkspace } from "./workspace";
1315
import { GraphQLLanguageProvider } from "./languageProvider";
@@ -95,7 +97,7 @@ connection.onInitialize(async ({ capabilities, workspaceFolders }) => {
9597
executeCommandProvider: {
9698
commands: []
9799
},
98-
textDocumentSync: documents.syncKind
100+
textDocumentSync: TextDocumentSyncKind.Incremental
99101
} as ServerCapabilities
100102
};
101103
});
@@ -114,7 +116,7 @@ connection.onInitialized(async () => {
114116
}
115117
});
116118

117-
const documents: TextDocuments = new TextDocuments();
119+
const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
118120

119121
// Make the text document manager listen on the connection
120122
// for open, change and close text document events

packages/apollo-language-server/src/utilities/debug.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IConnection } from "vscode-languageserver";
1+
import { Connection } from "vscode-languageserver";
22

33
/**
44
* for errors (and other logs in debug mode) we want to print
@@ -20,7 +20,7 @@ const createAndTrimStackTrace = () => {
2020
type Logger = (message?: any) => void;
2121

2222
export class Debug {
23-
private static connection?: IConnection;
23+
private static connection?: Connection;
2424
private static infoLogger: Logger = message =>
2525
console.log("[INFO] " + message);
2626
private static warningLogger: Logger = message =>
@@ -32,7 +32,7 @@ export class Debug {
3232
* Setting a connection overrides the default info/warning/error
3333
* loggers to pass a notification to the connection
3434
*/
35-
public static SetConnection(conn: IConnection) {
35+
public static SetConnection(conn: Connection) {
3636
Debug.connection = conn;
3737
Debug.infoLogger = message =>
3838
Debug.connection!.sendNotification("serverDebugMessage", {

0 commit comments

Comments
 (0)