format cpp and update tsl.vim
This commit is contained in:
@@ -121,24 +121,24 @@ namespace lsp
|
||||
log::Debug("Response length: ", byte_length);
|
||||
log::Debug("Raw response content: [", response_str, "]");
|
||||
|
||||
// 在程序启动时设置stdout为二进制模式(只需设置一次)
|
||||
static bool binary_mode_set = false;
|
||||
if (!binary_mode_set) {
|
||||
// 在程序启动时设置stdout为二进制模式(只需设置一次)
|
||||
static bool binary_mode_set = false;
|
||||
if (!binary_mode_set)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
_setmode(_fileno(stdout), _O_BINARY);
|
||||
#endif
|
||||
binary_mode_set = true;
|
||||
}
|
||||
|
||||
// 构建完整消息
|
||||
std::string header = "Content-Length: " + std::to_string(byte_length) + "\r\n\r\n";
|
||||
|
||||
// 使用 write 系统调用,绕过 C++ 流的缓冲和转换
|
||||
std::cout.write(header.c_str(), header.length());
|
||||
std::cout.write(response_str.c_str(), response_str.length());
|
||||
std::cout.flush();
|
||||
|
||||
log::Verbose("Response sent successfully2");
|
||||
binary_mode_set = true;
|
||||
}
|
||||
|
||||
// 构建完整消息
|
||||
std::string header = "Content-Length: " + std::to_string(byte_length) + "\r\n\r\n";
|
||||
|
||||
// 使用 write 系统调用,绕过 C++ 流的缓冲和转换
|
||||
std::cout.write(header.c_str(), header.length());
|
||||
std::cout.write(response_str.c_str(), response_str.length());
|
||||
std::cout.flush();
|
||||
|
||||
log::Verbose("Response sent successfully");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user