aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-03-16 10:35:37 -0700
committerChristian Clason <ch.clason+github@icloud.com>2025-03-16 19:12:36 +0100
commitc85d15e0d557eb74f768721fea6b5711a76d6fe2 (patch)
treee2207de3595085a5c269e6582bcb6d5499cd9c69
parent535c2f8658c4ace04807c578bebf741597dcb467 (diff)
downloadrneovim-c85d15e0d557eb74f768721fea6b5711a76d6fe2.tar.gz
rneovim-c85d15e0d557eb74f768721fea6b5711a76d6fe2.tar.bz2
rneovim-c85d15e0d557eb74f768721fea6b5711a76d6fe2.zip
perf(lsp): don't construct potentially expensive strings
-rw-r--r--runtime/doc/news.txt1
-rw-r--r--runtime/lua/vim/lsp/rpc.lua6
2 files changed, 3 insertions, 4 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index e74344cece..f7f86237f6 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -366,6 +366,7 @@ PERFORMANCE
significantly improving |treesitter-highlight| performance.
• Treesitter injection query iteration is now asynchronous, making edits in
large buffers with combined injections much quicker.
+• 10x reduction in blocking time when attaching an LSP to a large buffer.
PLUGINS
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index a0d1fe776b..d31d94cab7 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -278,10 +278,8 @@ function Client:encode_and_send(payload)
if self.transport:is_closing() then
return false
end
- local jsonstr = assert(
- vim.json.encode(payload),
- string.format("Couldn't encode payload '%s'", vim.inspect(payload))
- )
+ local jsonstr = vim.json.encode(payload)
+
self.transport:write(format_message_with_content_length(jsonstr))
return true
end