From c653c4a9a5c0a3cd5101ce86a3640ee12067ffcd Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 18 May 2024 12:09:07 +0200 Subject: [PATCH] perf(comments): `vim.schedule` ts-context-commentstring integration --- lua/lazyvim/plugins/coding.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 74caa45d..0cbdd7b6 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -190,11 +190,13 @@ return { }, init = function() if vim.fn.has("nvim-0.10") == 1 then - local get_option = vim.filetype.get_option - vim.filetype.get_option = function(filetype, option) - return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring() - or get_option(filetype, option) - end + vim.schedule(function() + local get_option = vim.filetype.get_option + vim.filetype.get_option = function(filetype, option) + return option == "commentstring" and require("ts_context_commentstring.internal").calculate_commentstring() + or get_option(filetype, option) + end + end) end end, },