|
@@ -35,7 +35,7 @@ export class ClientConnectionManager {
|
|
private status: ManagerStatus = ManagerStatus.INITIALIZING;
|
|
private status: ManagerStatus = ManagerStatus.INITIALIZING;
|
|
private statusWidget: vscode.StatusBarItem = null;
|
|
private statusWidget: vscode.StatusBarItem = null;
|
|
|
|
|
|
- private connectedVersion: string = "";
|
|
|
|
|
|
+ private connectedVersion = "";
|
|
|
|
|
|
constructor(private context: vscode.ExtensionContext) {
|
|
constructor(private context: vscode.ExtensionContext) {
|
|
this.context = context;
|
|
this.context = context;
|
|
@@ -125,11 +125,11 @@ export class ClientConnectionManager {
|
|
if (result.version[2] < minimumVersion) {
|
|
if (result.version[2] < minimumVersion) {
|
|
const message = `Cannot launch headless LSP: Headless LSP mode is only available on v${targetVersion} or newer, but the specified Godot executable is v${result.version}.`;
|
|
const message = `Cannot launch headless LSP: Headless LSP mode is only available on v${targetVersion} or newer, but the specified Godot executable is v${result.version}.`;
|
|
vscode.window.showErrorMessage(message, "Select Godot executable", "Open Settings", "Disable Headless LSP", "Ignore").then(item => {
|
|
vscode.window.showErrorMessage(message, "Select Godot executable", "Open Settings", "Disable Headless LSP", "Ignore").then(item => {
|
|
- if (item == "Select Godot executable") {
|
|
|
|
|
|
+ if (item === "Select Godot executable") {
|
|
select_godot_executable(settingName);
|
|
select_godot_executable(settingName);
|
|
- } else if (item == "Open Settings") {
|
|
|
|
|
|
+ } else if (item === "Open Settings") {
|
|
vscode.commands.executeCommand("workbench.action.openSettings", settingName);
|
|
vscode.commands.executeCommand("workbench.action.openSettings", settingName);
|
|
- } else if (item == "Disable Headless LSP") {
|
|
|
|
|
|
+ } else if (item === "Disable Headless LSP") {
|
|
set_configuration("lsp.headless", false);
|
|
set_configuration("lsp.headless", false);
|
|
prompt_for_reload();
|
|
prompt_for_reload();
|
|
}
|
|
}
|
|
@@ -192,7 +192,7 @@ export class ClientConnectionManager {
|
|
const message = `Connected to the GDScript language server at ${lspTarget}.`;
|
|
const message = `Connected to the GDScript language server at ${lspTarget}.`;
|
|
|
|
|
|
let options = ["Ok"];
|
|
let options = ["Ok"];
|
|
- if (this.target == TargetLSP.HEADLESS) {
|
|
|
|
|
|
+ if (this.target === TargetLSP.HEADLESS) {
|
|
options = ["Restart LSP", ...options];
|
|
options = ["Restart LSP", ...options];
|
|
}
|
|
}
|
|
vscode.window.showInformationMessage(message, ...options).then(item => {
|
|
vscode.window.showInformationMessage(message, ...options).then(item => {
|
|
@@ -262,6 +262,7 @@ export class ClientConnectionManager {
|
|
break;
|
|
break;
|
|
case ClientStatus.CONNECTED:
|
|
case ClientStatus.CONNECTED:
|
|
this.retry = false;
|
|
this.retry = false;
|
|
|
|
+ this.reconnectionAttempts = 0;
|
|
set_context("connectedToLSP", true);
|
|
set_context("connectedToLSP", true);
|
|
this.status = ManagerStatus.CONNECTED;
|
|
this.status = ManagerStatus.CONNECTED;
|
|
if (!this.client.started) {
|
|
if (!this.client.started) {
|
|
@@ -271,7 +272,7 @@ export class ClientConnectionManager {
|
|
case ClientStatus.DISCONNECTED:
|
|
case ClientStatus.DISCONNECTED:
|
|
set_context("connectedToLSP", false);
|
|
set_context("connectedToLSP", false);
|
|
if (this.retry) {
|
|
if (this.retry) {
|
|
- if (this.client.port != -1) {
|
|
|
|
|
|
+ if (this.client.port !== -1) {
|
|
this.status = ManagerStatus.INITIALIZING_LSP;
|
|
this.status = ManagerStatus.INITIALIZING_LSP;
|
|
} else {
|
|
} else {
|
|
this.status = ManagerStatus.RETRYING;
|
|
this.status = ManagerStatus.RETRYING;
|
|
@@ -317,15 +318,15 @@ export class ClientConnectionManager {
|
|
const message = `Couldn't connect to the GDScript language server at ${lspTarget}. Is the Godot editor or language server running?`;
|
|
const message = `Couldn't connect to the GDScript language server at ${lspTarget}. Is the Godot editor or language server running?`;
|
|
|
|
|
|
let options = ["Retry", "Ignore"];
|
|
let options = ["Retry", "Ignore"];
|
|
- if (this.target == TargetLSP.EDITOR) {
|
|
|
|
|
|
+ if (this.target === TargetLSP.EDITOR) {
|
|
options = ["Open workspace with Godot Editor", ...options];
|
|
options = ["Open workspace with Godot Editor", ...options];
|
|
}
|
|
}
|
|
|
|
|
|
vscode.window.showErrorMessage(message, ...options).then(item => {
|
|
vscode.window.showErrorMessage(message, ...options).then(item => {
|
|
- if (item == "Retry") {
|
|
|
|
|
|
+ if (item === "Retry") {
|
|
this.connect_to_language_server();
|
|
this.connect_to_language_server();
|
|
}
|
|
}
|
|
- if (item == "Open workspace with Godot Editor") {
|
|
|
|
|
|
+ if (item === "Open workspace with Godot Editor") {
|
|
vscode.commands.executeCommand("godotTools.openEditor");
|
|
vscode.commands.executeCommand("godotTools.openEditor");
|
|
this.connect_to_language_server();
|
|
this.connect_to_language_server();
|
|
}
|
|
}
|