Skip to content

Commit

Permalink
Update client to v7.0.0 to use of 3.16.0 spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Razoric480 committed Mar 19, 2022
1 parent 62cb49e commit 6e1b76c
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 36 deletions.
73 changes: 47 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"net": "^1.0.2",
"terminate": "^2.5.0",
"vscode-debugadapter": "^1.38.0",
"vscode-languageclient": "^5.2.1",
"vscode-languageclient": "^7.0.0",
"ws": "^8.4.2"
}
}
4 changes: 2 additions & 2 deletions src/godot-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class GodotTools {

private open_workspace_with_editor(params = "") {

return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
let valid = false;
if (this.workspace_dir) {
let cfg = path.join(this.workspace_dir, this.project_file);
Expand Down Expand Up @@ -79,7 +79,7 @@ export class GodotTools {

private run_editor(params = "") {

return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const run_godot = (path: string, params: string) => {
const is_powershell_path = (path?: string) => {
const POWERSHELL = "powershell.exe";
Expand Down
2 changes: 1 addition & 1 deletion src/lsp/GDScriptLanguageClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, RequestMessage } from "vscode-languageclient";
import { LanguageClient, LanguageClientOptions, ServerOptions, RequestMessage } from "vscode-languageclient/node";
import { is_debug_mode, get_configuration } from "../utils";
import { MessageIO, MessageIOReader, MessageIOWriter, Message, WebsocktMessageIO, TCPMessageIO } from "./MessageIO";
import logger from "../loggger";
Expand Down
18 changes: 13 additions & 5 deletions src/lsp/MessageIO.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AbstractMessageReader, MessageReader, DataCallback } from "vscode-jsonrpc/lib/messageReader";
import { AbstractMessageReader, MessageReader, DataCallback, Disposable } from "vscode-jsonrpc";
import { EventEmitter } from "events";
import * as WebSocket from 'ws';
import { Socket } from 'net';

import MessageBuffer from "./MessageBuffer";
import { AbstractMessageWriter, MessageWriter } from "vscode-jsonrpc/lib/messageWriter";
import { RequestMessage, ResponseMessage, NotificationMessage } from "vscode-jsonrpc/lib/messages";
import { AbstractMessageWriter, MessageWriter } from "vscode-jsonrpc";
import { RequestMessage, ResponseMessage, NotificationMessage } from "vscode-jsonrpc";
export type Message = RequestMessage | ResponseMessage | NotificationMessage;

export class MessageIO extends EventEmitter {
Expand Down Expand Up @@ -127,7 +127,7 @@ export class MessageIOReader extends AbstractMessageReader implements MessageRea
return this._partialMessageTimeout;
}

public listen(callback: DataCallback): void {
public listen(callback: DataCallback): Disposable {
this.nextMessageLength = -1;
this.messageToken = 0;
this.partialMessageTimer = undefined;
Expand All @@ -137,6 +137,8 @@ export class MessageIOReader extends AbstractMessageReader implements MessageRea
});
this.io.on('error', (error: any) => this.fireError(error));
this.io.on('close', () => this.fireClose());

return;
}

private onData(data: Buffer | String): void {
Expand Down Expand Up @@ -214,8 +216,12 @@ export class MessageIOWriter extends AbstractMessageWriter implements MessageWri
this.io.on('error', (error: any) => this.fireError(error));
this.io.on('close', () => this.fireClose());
}

public end(): void {

}

public write(msg: Message): void {
public write(msg: Message): Promise<void> {
let json = JSON.stringify(msg);
let contentLength = Buffer.byteLength(json, this.encoding);

Expand All @@ -235,5 +241,7 @@ export class MessageIOWriter extends AbstractMessageWriter implements MessageWri
this.errorCount++;
this.fireError(error, msg, this.errorCount);
}

return;
}
}
2 changes: 1 addition & 1 deletion src/lsp/NativeDocumentManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class NativeDocumentManager extends EventEmitter {
this.io = io;
io.on("message", (message: NotificationMessage) => {
if (message.method == Methods.SHOW_NATIVE_SYMBOL) {
this.show_native_symbol(message.params);
this.show_native_symbol(message.params as GodotNativeSymbol);
} else if (message.method == Methods.GDSCRIPT_CAPABILITIES) {
for (const gdclass of (message.params as GodotCapabilities)
.native_classes) {
Expand Down

0 comments on commit 6e1b76c

Please sign in to comment.