Add SQL, Erlang, and Forth highlighter implementations and tests for LSP process and transport handling.
- Added highlighters for new languages (SQL, Erlang, Forth) with filetype recognition. - Updated and reorganized syntax files to maintain consistency and modularity. - Introduced LSP transport framing unit tests and JSON decoding/dispatch tests. - Refactored `LspManager`, integrating UTF-16/UTF-8 position conversions and robust diagnostics handling. - Enhanced server start/restart logic with workspace root detection and logging to improve LSP usability.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* JsonRpcTransport.h - placeholder transport for JSON-RPC over stdio (stub)
|
||||
* JsonRpcTransport.h - minimal JSON-RPC over stdio transport
|
||||
*/
|
||||
#ifndef KTE_JSON_RPC_TRANSPORT_H
|
||||
#define KTE_JSON_RPC_TRANSPORT_H
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
namespace kte::lsp {
|
||||
struct JsonRpcMessage {
|
||||
@@ -18,11 +19,24 @@ public:
|
||||
|
||||
~JsonRpcTransport() = default;
|
||||
|
||||
// Send a method call (request or notification) - stub does nothing
|
||||
// Connect this transport to file descriptors (read from inFd, write to outFd)
|
||||
void connect(int inFd, int outFd);
|
||||
|
||||
// Send a method call (request or notification)
|
||||
// 'payload' should be a complete JSON object string to send as the message body.
|
||||
void send(const std::string &method, const std::string &payload);
|
||||
|
||||
// Blocking read next message (stub => returns nullopt)
|
||||
// Blocking read next message; returns nullopt on EOF or error
|
||||
std::optional<JsonRpcMessage> read();
|
||||
|
||||
private:
|
||||
int inFd_ = -1;
|
||||
int outFd_ = -1;
|
||||
std::mutex writeMutex_;
|
||||
|
||||
// Limits to keep the transport resilient
|
||||
static constexpr size_t kMaxHeaderLine = 16 * 1024; // 16 KiB per header line
|
||||
static constexpr size_t kMaxBody = 64ull * 1024ull * 1024ull; // 64 MiB body cap
|
||||
};
|
||||
} // namespace kte::lsp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user