Skip to content

Commit 5a58870

Browse files
Anup SebastianAnup Sebastian
authored andcommitted
fix: snippet error suppress
1 parent fa86178 commit 5a58870

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lua/custom/plugins/flutter.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ return {
9292

9393
lsp = {
9494
capabilities = capabilities,
95+
96+
-- Suppress didChange errors during snippet expansion
97+
on_attach = function(client, bufnr)
98+
-- Reduce didChange notification frequency to prevent errors with snippets
99+
client.server_capabilities.textDocumentSync = vim.tbl_deep_extend('force', client.server_capabilities.textDocumentSync or {}, {
100+
change = 2, -- 2 = Incremental (less prone to errors than full sync)
101+
})
102+
103+
-- Filter out didChange error notifications (they're harmless during snippet expansion)
104+
local notify = vim.notify
105+
vim.notify = function(msg, level, opts)
106+
if type(msg) == 'string' and msg:match('textDocument/didChange') then
107+
return -- Suppress this specific error
108+
end
109+
notify(msg, level, opts)
110+
end
111+
end,
112+
95113
-- Color preview for dart variables (Colors.red, Color(0xFF...), etc.)
96114
-- This shows the actual Material Design colors inline!
97115
color = {

0 commit comments

Comments
 (0)