Merge pull request #52330 from johnjdonna/add_support_hostname_language_server
LSP: Add support for custom host setting
This commit is contained in:
commit
a92c58ed3e
@ -36,6 +36,7 @@
|
|||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
|
|
||||||
GDScriptLanguageServer::GDScriptLanguageServer() {
|
GDScriptLanguageServer::GDScriptLanguageServer() {
|
||||||
|
_EDITOR_DEF("network/language_server/remote_host", host);
|
||||||
_EDITOR_DEF("network/language_server/remote_port", port);
|
_EDITOR_DEF("network/language_server/remote_port", port);
|
||||||
_EDITOR_DEF("network/language_server/enable_smart_resolve", true);
|
_EDITOR_DEF("network/language_server/enable_smart_resolve", true);
|
||||||
_EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false);
|
_EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false);
|
||||||
@ -56,9 +57,10 @@ void GDScriptLanguageServer::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
|
String host = String(_EDITOR_GET("network/language_server/remote_host"));
|
||||||
int port = (int)_EDITOR_GET("network/language_server/remote_port");
|
int port = (int)_EDITOR_GET("network/language_server/remote_port");
|
||||||
bool use_thread = (bool)_EDITOR_GET("network/language_server/use_thread");
|
bool use_thread = (bool)_EDITOR_GET("network/language_server/use_thread");
|
||||||
if (port != this->port || use_thread != this->use_thread) {
|
if (host != this->host || port != this->port || use_thread != this->use_thread) {
|
||||||
this->stop();
|
this->stop();
|
||||||
this->start();
|
this->start();
|
||||||
}
|
}
|
||||||
@ -76,9 +78,10 @@ void GDScriptLanguageServer::thread_main(void *p_userdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GDScriptLanguageServer::start() {
|
void GDScriptLanguageServer::start() {
|
||||||
|
host = String(_EDITOR_GET("network/language_server/remote_host"));
|
||||||
port = (int)_EDITOR_GET("network/language_server/remote_port");
|
port = (int)_EDITOR_GET("network/language_server/remote_port");
|
||||||
use_thread = (bool)_EDITOR_GET("network/language_server/use_thread");
|
use_thread = (bool)_EDITOR_GET("network/language_server/use_thread");
|
||||||
if (protocol.start(port, IPAddress("127.0.0.1")) == OK) {
|
if (protocol.start(port, IPAddress(host)) == OK) {
|
||||||
EditorNode::get_log()->add_message("--- GDScript language server started ---", EditorLog::MSG_TYPE_EDITOR);
|
EditorNode::get_log()->add_message("--- GDScript language server started ---", EditorLog::MSG_TYPE_EDITOR);
|
||||||
if (use_thread) {
|
if (use_thread) {
|
||||||
thread_running = true;
|
thread_running = true;
|
||||||
|
@ -44,6 +44,7 @@ class GDScriptLanguageServer : public EditorPlugin {
|
|||||||
bool thread_running = false;
|
bool thread_running = false;
|
||||||
bool started = false;
|
bool started = false;
|
||||||
bool use_thread = false;
|
bool use_thread = false;
|
||||||
|
String host = "127.0.0.1";
|
||||||
int port = 6008;
|
int port = 6008;
|
||||||
static void thread_main(void *p_userdata);
|
static void thread_main(void *p_userdata);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user