From 096d8f818a8c199bd813a84652bd1d51dd0e9448 Mon Sep 17 00:00:00 2001 From: Igor Khramtsov Date: Tue, 13 Feb 2024 19:24:55 +0400 Subject: [PATCH] fix: don't attach lsp to buffer with empty path --- lua/flutter-tools/lsp/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/flutter-tools/lsp/init.lua b/lua/flutter-tools/lsp/init.lua index 391b667..cc5d465 100644 --- a/lua/flutter-tools/lsp/init.lua +++ b/lua/flutter-tools/lsp/init.lua @@ -181,6 +181,8 @@ end --- Checks if buffer path is valid for attaching LSP local function is_valid_path(buffer_path) + if buffer_path == "" then return false end + local start_index, _, uri_prefix = buffer_path:find("^(%w+://).*") -- Do not attach LSP if file URI prefix is not file. -- For example LSP will not be attached for diffview:// or fugitive:// buffers.