perf: fix slice boundary panics, eliminate string allocation in stdio reader, fix lua table nesting bug, and optimize nvim socket chunk size
This commit is contained in:
1 parent
e215720416
commit
02f40604e1
3 files changed
+8
-6
No files matched your search
@@ -25,7 +25,7 @@ pub async fn send_response(response: JsonRpcResponse) {
|
||||
tracing::info!(
|
||||
"Sending JSON-RPC response (id: {:?}): {}{}",
|
||||
response.id,
|
||||
&msg[..std::cmp::min(msg.len(), 500)],
|
||||
&msg[..msg.floor_char_boundary(500)],
|
||||
if msg.len() > 500 { "..." } else { "" }
|
||||
);
|
||||
// CRITICAL ARCHITECTURAL DECISION:
|
||||
@@ -182,7 +182,7 @@ async fn get_nvim_connection() -> Result<mpsc::Sender<NvimRequest>, String> {
|
||||
let pending_clone2 = Arc::clone(&pending_requests);
|
||||
tokio::spawn(async move {
|
||||
let mut resp_buf = Vec::new();
|
||||
let mut chunk = vec![0u8; 8192];
|
||||
let mut chunk = vec![0u8; 65536];
|
||||
let mut offset = 0;
|
||||
|
||||
loop {
|
||||
@@ -957,7 +957,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) {
|
||||
local first = vim.fn.line('w0')
|
||||
local last = vim.fn.line('w$')
|
||||
local lines = vim.api.nvim_buf_get_lines(0, first - 1, last, false)
|
||||
local res = {{}}
|
||||
local res = {}
|
||||
for i, line in ipairs(lines) do
|
||||
table.insert(res, tostring(first + i - 1) .. ': ' .. line)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user