From 56cba778717dcac3bee2b37498a60db7374cdf00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tautvydas=20S=CC=8Cidlauskas?= Date: Sun, 20 Apr 2025 13:42:42 +0300 Subject: [PATCH] fix: use first found line for package position pubspec may contain plugin configuration at the bottom, i.e. ``` flutter_native_splash: image: assets/images/splash.png ``` This fix will pick first found line as package location --- lua/pubspec-assist.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/pubspec-assist.lua b/lua/pubspec-assist.lua index b959eaa..0775f23 100644 --- a/lua/pubspec-assist.lua +++ b/lua/pubspec-assist.lua @@ -57,6 +57,7 @@ local icons = { ---@field error table ---@field name string ---@field type number +---@field ui table ---@table> local packages = {} @@ -178,7 +179,9 @@ local function get_lnum_lookup(lines) local key = line:match(".-:") if key then local package_name = vim.trim(key:gsub(":", "")) - lookup[package_name] = lnum + if not lookup[package_name] then + lookup[package_name] = lnum + end end end end