🐛 fix(core): enforce strict LSP lifecycle

This commit is contained in:
csh
2026-07-13 21:35:40 +08:00
parent 5edd4b3637
commit 06a0da5124
21 changed files with 555 additions and 664 deletions
+11 -4
View File
@@ -6,6 +6,7 @@ import spdlog;
import std;
import lsp.core.server;
import lsp.provider.manifest;
import lsp.utils.args_parser;
namespace
@@ -46,11 +47,17 @@ export int Run(int argc, char* argv[])
return 1;
}
int exit_code = 1;
try
{
spdlog::info("TSL-LSP server starting...");
lsp::core::LspServer server(config.thread_count, config.interpreter_path);
server.Run();
lsp::core::LspServer server(
std::cin,
std::cout,
lsp::provider::RegisterAllProviders,
config.thread_count,
config.interpreter_path);
exit_code = server.Run();
}
catch (const std::exception& error)
{
@@ -67,7 +74,7 @@ export int Run(int argc, char* argv[])
return 1;
}
spdlog::info("TSL-LSP server stopped normally");
spdlog::info("TSL-LSP server stopped with exit code {}", exit_code);
spdlog::shutdown();
return 0;
return exit_code;
}