🐛 fix(core): enforce strict LSP lifecycle
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user