From c7a0f37229714d26908d98233dd082956230e3af Mon Sep 17 00:00:00 2001 From: Curtis Date: Tue, 29 Apr 2025 10:08:41 -0600 Subject: [PATCH] fix syntax error --- lua/convert/convert_all.lua | 28 +++++++++++++--------------- lua/convert/ui/open_popup.lua | 2 ++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lua/convert/convert_all.lua b/lua/convert/convert_all.lua index 59cc793..6a6718e 100644 --- a/lua/convert/convert_all.lua +++ b/lua/convert/convert_all.lua @@ -17,26 +17,24 @@ local convert_all = function(bufnr, from, to) to_type = 'size' end if from_type ~= to_type then - print(string.format("Can't convert %s to %s units", from_type, to_type)) return end local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) - local all_units = utils.find_all_units_in_line(line, row) - if all_units ~= nil and #all_units > 0 and all_units[1].unit == from then - for i = #all_units, 1, -1 do - local found = all_units[i] - local converted = calculator.convert(from, to, found.val) + local all_units = utils.find_all_units_in_line(line, row) + if all_units ~= nil and #all_units > 0 and all_units[1].unit == from then + for i = #all_units, 1, -1 do + local found = all_units[i] + local converted = calculator.convert(from, to, found.val) - vim.api.nvim_buf_set_text( - bufnr, - found.pos.row - 1, - found.pos.start_col - 1, - found.pos.row - 1, - found.pos.end_col, - { converted } - ) - end + vim.api.nvim_buf_set_text( + bufnr, + found.pos.row - 1, + found.pos.start_col - 1, + found.pos.row - 1, + found.pos.end_col, + { converted } + ) end end end diff --git a/lua/convert/ui/open_popup.lua b/lua/convert/ui/open_popup.lua index 17cd4ee..a28bc2b 100644 --- a/lua/convert/ui/open_popup.lua +++ b/lua/convert/ui/open_popup.lua @@ -3,6 +3,8 @@ local calculator = require("convert.calculator") local utils = require("convert.utils") local config = require("convert.config") +local M = {} + local size_units = { 'px', 'rem',