♻️ refactor(lsp_server): move entrypoints out of named modules

- export Run() from launcher module and add non-module main TU
- apply same pattern to module-based test executables
- migrate utils/string implementation fully into string.cppm and drop string.cpp
- point clangd to linux build compilation database
This commit is contained in:
csh
2025-12-13 19:55:45 +08:00
parent f7d5a74615
commit e5782c76fa
24 changed files with 188 additions and 147 deletions
+46
View File
@@ -0,0 +1,46 @@
module;
export module lsp.cli.launcher;
import spdlog;
import std;
import lsp.core.server;
import lsp.utils.args_parser;
export int Run(int argc, char* argv[])
{
lsp::utils::ArgsParser& args_parser = lsp::utils::ArgsParser::Instance();
auto& config = args_parser.Parse(argc, argv);
if (config.show_help)
{
lsp::utils::ArgsParser::PrintHelp(argv[0]);
return 0;
}
lsp::utils::ArgsParser::SetupLogger(config);
try
{
spdlog::info("TSL-LSP server starting...");
lsp::core::LspServer server(config.thread_count);
server.Run();
}
catch (const std::exception& e)
{
std::cerr << "[TSL-LSP] Server fatal error: " << e.what() << std::endl;
spdlog::error("Server fatal error: {}", e.what());
return 1;
}
catch (...)
{
std::cerr << "[TSL-LSP] Server unknown fatal error" << std::endl;
spdlog::error("Server unknown fatal error");
return 1;
}
spdlog::info("TSL-LSP server stopped normally");
spdlog::shutdown();
return 0;
}