fix lag and add buffer management
This commit is contained in:
parent
9f86c36b7e
commit
e045491ec1
8 changed files with 121 additions and 24 deletions
|
|
@ -8,14 +8,49 @@ return {
|
|||
},
|
||||
config = function()
|
||||
vim.opt.termguicolors = true
|
||||
vim.api.nvim_create_autocmd({ "TextChanged", "BufWinEnter" }, {
|
||||
pattern = "*__FLUTTER_DEV_LOG__*",
|
||||
callback = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
|
||||
if vim.bo[buf].filetype == "log" or vim.fn.bufname(buf):match("flutter%-dev%.log") then
|
||||
vim.cmd("normal! G")
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "log",
|
||||
callback = function(ev)
|
||||
if not vim.fn.bufname(ev.buf):match("FLUTTER_DEV_LOG") then
|
||||
return
|
||||
end
|
||||
|
||||
if vim.b[ev.buf].flutter_autoscroll_attached then
|
||||
return
|
||||
end
|
||||
vim.b[ev.buf].flutter_autoscroll_attached = true
|
||||
|
||||
local pinned = true
|
||||
|
||||
vim.api.nvim_create_autocmd("WinScrolled", {
|
||||
callback = function()
|
||||
local wins = vim.fn.win_findbuf(ev.buf)
|
||||
for _, win in ipairs(wins) do
|
||||
local info = vim.fn.getwininfo(win)[1]
|
||||
if info then
|
||||
pinned = info.botline >= vim.api.nvim_buf_line_count(ev.buf)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_buf_attach(ev.buf, false, {
|
||||
on_lines = function()
|
||||
if not pinned then
|
||||
return
|
||||
end
|
||||
vim.schedule(function()
|
||||
local line_count = vim.api.nvim_buf_line_count(ev.buf)
|
||||
local wins = vim.fn.win_findbuf(ev.buf)
|
||||
for _, win in ipairs(wins) do
|
||||
pcall(vim.api.nvim_win_set_cursor, win, { line_count, 0 })
|
||||
end
|
||||
end)
|
||||
end,
|
||||
on_detach = function()
|
||||
vim.b[ev.buf].flutter_autoscroll_attached = nil
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -34,18 +69,36 @@ return {
|
|||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
client.server_capabilities.documentOnTypeFormattingProvider = nil
|
||||
-- client.server_capabilities.documentOnTypeFormattingProvider = nil
|
||||
-- client.server_capabilities.diagnosticProvider = nil
|
||||
end,
|
||||
flags = {
|
||||
debounce_text_changes = 150, -- milliseconds
|
||||
},
|
||||
settings = {
|
||||
showTodos = true,
|
||||
completeFunctionCalls = false,
|
||||
showTodos = false,
|
||||
completeFunctionCalls = true,
|
||||
renameFilesWithClasses = "prompt",
|
||||
enableSnippets = true,
|
||||
updateImportsOnRename = true,
|
||||
analysisExcludedFolders = {
|
||||
vim.fn.expand("$HOME/.pub-cache"),
|
||||
vim.fn.expand("$HOME/Git/flutter"),
|
||||
vim.fn.getcwd() .. "/android",
|
||||
vim.fn.getcwd() .. "/app",
|
||||
vim.fn.getcwd() .. "/build",
|
||||
vim.fn.getcwd() .. "/build-dir",
|
||||
vim.fn.getcwd() .. "/flatpak",
|
||||
vim.fn.getcwd() .. "/ios",
|
||||
vim.fn.getcwd() .. "/linux",
|
||||
vim.fn.getcwd() .. "/macos",
|
||||
vim.fn.getcwd() .. "/repo",
|
||||
vim.fn.getcwd() .. "/web",
|
||||
vim.fn.getcwd() .. "/windows",
|
||||
vim.fn.getcwd() .. "/.dart_tool",
|
||||
vim.fn.getcwd() .. "/.flatpak-builder",
|
||||
vim.fn.getcwd() .. "/.idea",
|
||||
},
|
||||
},
|
||||
},
|
||||
widget_guides = {
|
||||
|
|
@ -77,6 +130,8 @@ return {
|
|||
user_command("FEmulators", "FlutterEmulators", {})
|
||||
user_command("FLogs", "FlutterLogToggle", {})
|
||||
user_command("FLogsClear", "FlutterLogClear", {})
|
||||
user_command("FLogs", "FlutterLogToggle", {})
|
||||
user_command("FLspRestart", "lsp restart", {})
|
||||
user_command("FPubGet", "FlutterPubGet", {})
|
||||
user_command("FDevToolsStart", "FlutterDevTools", {})
|
||||
user_command("FDevToolsOpen", "FlutterOpenDevTools", {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue