diff --git a/lua/lualine/component.lua b/lua/lualine/component.lua index f660aa9..f461501 100644 --- a/lua/lualine/component.lua +++ b/lua/lualine/component.lua @@ -7,29 +7,6 @@ local M = require('lualine.utils.class'):extend() -- Used to provide a unique id for each component local component_no = 1 -local function check_deprecated_options(options) - local function rename_notice(before, now) - if options[before] then - require('lualine.utils.notices').add_notice(string.format( - [[ -### option.%s -%s option has been renamed to `%s`. Please use `%s` instead in your config -for %s component. -]], - before, - before, - now, - now, - options.component_name or 'function' - )) - options[now] = options[before] - options[before] = nil - end - end - rename_notice('format', 'fmt') - rename_notice('condition', 'cond') -end - function M:__tostring() local str = 'Component: ' .. self.options.component_name if self.debug then @@ -42,7 +19,6 @@ end function M:init(options) self.options = options or {} component_no = component_no + 1 - check_deprecated_options(self.options) if not options.component_name then self.options.component_name = tostring(component_no) end @@ -74,19 +50,6 @@ function M:create_option_highlights() end end --- set upper or lower case -function M:apply_case() - -- Donn't work on components that emit vim statusline escaped chars - if self.status:find '%%' and not self.status:find '%%%%' then - return - end - if self.options.upper == true then - self.status = self.status:upper() - elseif self.options.lower == true then - self.status = self.status:lower() - end -end - -- Adds spaces to left and right of a component function M:apply_padding() local padding = self.options.padding @@ -206,7 +169,6 @@ function M:draw(default_highlight, is_focused) if type(status) == 'string' and #status > 0 then self.status = status self:apply_icon() - self:apply_case() self:apply_padding() self:apply_highlights(default_highlight) self:apply_section_separators() diff --git a/lua/lualine/components/diagnostics.lua b/lua/lualine/components/diagnostics.lua index 7eb024d..b7fe114 100644 --- a/lua/lualine/components/diagnostics.lua +++ b/lua/lualine/components/diagnostics.lua @@ -9,33 +9,6 @@ local modules = lualine_require.lazy_require { local M = lualine_require.require 'lualine.component':extend() -local function check_deprecated_options(options) - if options.color_error or options.color_warn or options.color_info or options.color_hint then - options.diagnostics_color = options.diagnostics_color or {} - require('lualine.utils.notices').add_notice(string.format [[ -### diagnostics.options.colors -Previously colors in diagnostics section was set with color_error, color_warning.. -separate options . They've been unified under diagnostics_color options. -Now it should be something like: -```lua -{ 'diagnostics', - sources = {'nvim_lsp'}, - diagnostics_color = { - error = color_error, - warning = color_warning, - info = color_info, - hint = color_hint, - } -} -``` -]]) - options.diagnostics_color.error = options.color_error - options.diagnostics_color.warning = options.color_warning - options.diagnostics_color.info = options.color_info - options.diagnostics_color.hint = options.color_hint - end -end - local default_symbols = { icons = { error = ' ', -- xf659 @@ -88,7 +61,6 @@ function M:init(options) M.super.init(self, options) -- Apply default options self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) - check_deprecated_options(self.options) -- Apply default symbols self.symbols = vim.tbl_extend( 'keep', diff --git a/lua/lualine/components/diff.lua b/lua/lualine/components/diff.lua index b77c972..246c983 100644 --- a/lua/lualine/components/diff.lua +++ b/lua/lualine/components/diff.lua @@ -9,30 +9,6 @@ local modules = lualine_require.lazy_require { } local M = lualine_require.require('lualine.component'):extend() -local function check_deprecated_options(options) - if options.color_added or options.color_modified or options.color_removed then - options.diagnostics_color = options.diagnostics_color or {} - require('lualine.utils.notices').add_notice(string.format [[ -### diff.options.colors -Previously colors in diff section was set with color_added, color_modified.. -separate options . They've been unified under diff_color option. -Now it should be something like: -```lua -{ 'diff', - diff_color = { - added = color_added, - modified = color_modified, - removed = color_removed, - } -} -``` -]]) - options.diff_color.added = options.color_added - options.diff_color.modified = options.color_modified - options.diff_color.removed = options.color_removed - end -end - -- Vars -- variable to store git diff stats M.git_diff = nil @@ -64,7 +40,6 @@ local default_options = { function M:init(options) M.super.init(self, options) self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) - check_deprecated_options(self.options) -- create highlights and save highlight_name in highlights table if self.options.colored then self.highlights = { diff --git a/lua/lualine/components/filetype.lua b/lua/lualine/components/filetype.lua index 2c26a03..89b74d2 100644 --- a/lua/lualine/components/filetype.lua +++ b/lua/lualine/components/filetype.lua @@ -7,27 +7,6 @@ local modules = lualine_require.lazy_require { } local M = lualine_require.require('lualine.component'):extend() -local function check_deprecated_options(options) - local function rename_notice(before, now) - if options[before] then - require('lualine.utils.notices').add_notice(string.format( - [[ -### option.%s -%s option has been renamed to `%s`. Please use `%s` instead in your config -for filetype component. -]], - before, - before, - now, - now - )) - options[now] = options[before] - options[before] = nil - end - end - rename_notice('disable_text', 'icon_only') -end - local default_options = { colored = true, icon_only = false, @@ -36,7 +15,6 @@ local default_options = { function M:init(options) M.super.init(self, options) self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) - check_deprecated_options(self.options) end function M.update_status() diff --git a/lua/lualine/config.lua b/lua/lualine/config.lua index a09cfba..ae5527e 100644 --- a/lua/lualine/config.lua +++ b/lua/lualine/config.lua @@ -29,25 +29,11 @@ local config = { extensions = {}, } -local function check_sep_format_deprecation(sep) - if type(sep) == 'table' and vim.tbl_islist(sep) then - require('lualine.utils.notices').add_persistent_notice(string.format [[ -### option.separator -Using list for configuring separators has been deprecated. Please configure it -with {left = left_sep, right = right_sep} like table. -]]) - sep = { left = sep[1], right = sep[2] or sep[1] } - end - return sep -end - -- change separator format 'x' to {left='x', right='x'} local function fix_separators(separators) if separators ~= nil then if type(separators) == 'string' then return { left = separators, right = separators } - else - return check_sep_format_deprecation(separators) end end return separators diff --git a/lua/lualine/utils/loader.lua b/lua/lualine/utils/loader.lua index 45a7788..ef79d13 100644 --- a/lua/lualine/utils/loader.lua +++ b/lua/lualine/utils/loader.lua @@ -78,79 +78,6 @@ end local function option_deprecatation_notice(component) local types = { - case = function() - local kind = component.upper ~= nil and 'upper' or 'lower' - modules.notice.add_notice(string.format( - [[ -### option.%s - -Option `%s` has been deprecated. -Please use `fmt` option if you need to change case of a component. - -You have some thing like this in your config: - -```lua - %s = true, -``` - -You'll have to change it to this to retain old behavior: - -```lua - fmt = string.%s -``` -]], - kind, - kind, - kind, - kind - )) - end, - padding = function() - local kind = component.left_padding ~= nil and 'left_padding' or 'right_padding' - modules.notice.add_notice(string.format( - [[ -### option.%s - -Option `%s` has been deprecated. -Please use `padding` option to set left/right padding. - -You have some thing like this in your config: - -```lua - %s = %d, -``` - -You'll have to change it to this to retain old behavior: - -```lua - padding = { %s = %d } -``` -if you've set both left_padding and right_padding for a component -you'll need to have something like -```lua - padding = { left = x, right = y } -``` -When you set `padding = x` it's same as `padding = {left = x, right = x}` -]], - kind, - kind, - kind, - component[kind], - kind == 'left_padding' and 'left' or 'right', - component[kind] - )) - if component.left_padding and component.right_padding then - component.padding = { left = component.left_padding, right = component.right_padding } - component.left_padding = nil - component.right_padding = nil - elseif component.left_padding then - component.padding = { left = component.left_padding, right = 1 } - component.left_padding = nil - else - component.padding = { left = 1, right = component.right_padding } - component.right_padding = nil - end - end, type_name = function() local changed_to = component.type == 'luae' and 'lua_expr' or 'vim_fun' modules.notice.add_notice(string.format( @@ -182,12 +109,6 @@ You'll have to change it to this to retain old behavior: component.type = changed_to end, } - if component.upper ~= nil or component.lower ~= nil then - types.case() - end - if component.left_padding ~= nil or component.right_padding ~= nil then - types.padding() - end if component.type == 'luae' or component.type == 'vimf' then types.type_name() end diff --git a/lua/tests/spec/component_spec.lua b/lua/tests/spec/component_spec.lua index 3e0f74a..5d616cc 100644 --- a/lua/tests/spec/component_spec.lua +++ b/lua/tests/spec/component_spec.lua @@ -90,27 +90,6 @@ describe('Component:', function() end) describe('Global options:', function() - it('upper', function() - local opts = build_component_opts { - component_separators = { left = '', right = '' }, - padding = 0, - upper = true, - } - assert_component(nil, opts, 'TEST') - end) - - it('lower', function() - local opts = build_component_opts { - function() - return 'TeSt' - end, - component_separators = { left = '', right = '' }, - padding = 0, - lower = true, - } - assert_component(nil, opts, 'test') - end) - it('left_padding', function() local opts = build_component_opts { component_separators = { left = '', right = '' }, diff --git a/lua/tests/spec/config_spec.lua b/lua/tests/spec/config_spec.lua index 484e6d7..df5d48c 100644 --- a/lua/tests/spec/config_spec.lua +++ b/lua/tests/spec/config_spec.lua @@ -63,11 +63,14 @@ describe('config parsing', function() end) it('table', function() local config = { - options = { component_separators = { 'a' }, section_separators = { 'b' } }, + options = { + component_separators = { left = 'a', right = 'b' }, + section_separators = { left = 'b', right = 'a' }, + }, } config = config_module.apply_configuration(config) - eq(config.options.component_separators, { left = 'a', right = 'a' }) - eq(config.options.section_separators, { left = 'b', right = 'b' }) + eq(config.options.component_separators, { left = 'a', right = 'b' }) + eq(config.options.section_separators, { left = 'b', right = 'a' }) end) end) it('no seprarators', function()