break: deprecate utils.get_default utils.if_nil (#1545)

This commit is contained in:
Simon Hauser
2022-05-22 12:53:37 +02:00
committed by Simon Hauser
parent a1aec79cb1
commit 83b6cadb2c
12 changed files with 81 additions and 81 deletions

View File

@@ -272,7 +272,7 @@ end
-- TODO: finish docs for opts.show_line
files.treesitter = function(opts)
opts.show_line = utils.get_default(opts.show_line, true)
opts.show_line = vim.F.if_nil(opts.show_line, true)
local has_nvim_treesitter, _ = pcall(require, "nvim-treesitter")
if not has_nvim_treesitter then

View File

@@ -22,8 +22,8 @@ git.files = function(opts)
return
end
local show_untracked = utils.get_default(opts.show_untracked, false)
local recurse_submodules = utils.get_default(opts.recurse_submodules, false)
local show_untracked = vim.F.if_nil(opts.show_untracked, false)
local recurse_submodules = vim.F.if_nil(opts.recurse_submodules, false)
if show_untracked and recurse_submodules then
utils.notify("builtin.git_files", {
msg = "Git does not support both --others and --recurse-submodules",
@@ -317,7 +317,7 @@ git.status = function(opts)
end
local gen_new_finder = function()
local expand_dir = utils.if_nil(opts.expand_dir, true, opts.expand_dir)
local expand_dir = vim.F.if_nil(opts.expand_dir, true)
local git_cmd = { "git", "status", "-s", "--", "." }
if expand_dir then
@@ -374,7 +374,7 @@ local set_opts_cwd = function(opts)
-- Find root of git directory and remove trailing newline characters
local git_root, ret = utils.get_os_command_output({ "git", "rev-parse", "--show-toplevel" }, opts.cwd)
local use_git_root = utils.get_default(opts.use_git_root, true)
local use_git_root = vim.F.if_nil(opts.use_git_root, true)
if ret ~= 0 then
local in_worktree = utils.get_os_command_output({ "git", "rev-parse", "--is-inside-work-tree" }, opts.cwd)

View File

@@ -32,7 +32,7 @@ end
local internal = {}
internal.builtin = function(opts)
opts.include_extensions = utils.get_default(opts.include_extensions, false)
opts.include_extensions = vim.F.if_nil(opts.include_extensions, false)
local objs = {}
@@ -464,7 +464,7 @@ end
internal.oldfiles = function(opts)
opts = apply_cwd_only_aliases(opts)
opts.include_current_session = utils.get_default(opts.include_current_session, true)
opts.include_current_session = vim.F.if_nil(opts.include_current_session, true)
local current_buffer = vim.api.nvim_get_current_buf()
local current_file = vim.api.nvim_buf_get_name(current_buffer)
@@ -610,8 +610,8 @@ internal.vim_options = function(opts)
end
internal.help_tags = function(opts)
opts.lang = utils.get_default(opts.lang, vim.o.helplang)
opts.fallback = utils.get_default(opts.fallback, true)
opts.lang = vim.F.if_nil(opts.lang, vim.o.helplang)
opts.fallback = vim.F.if_nil(opts.fallback, true)
opts.file_ignore_patterns = {}
local langs = vim.split(opts.lang, ",", true)
@@ -714,7 +714,7 @@ internal.help_tags = function(opts)
end
internal.man_pages = function(opts)
opts.sections = utils.get_default(opts.sections, { "1" })
opts.sections = vim.F.if_nil(opts.sections, { "1" })
assert(vim.tbl_islist(opts.sections), "sections should be a list")
opts.man_cmd = utils.get_lazy_default(opts.man_cmd, function()
local is_darwin = vim.loop.os_uname().sysname == "Darwin"

View File

@@ -186,7 +186,7 @@ lsp.workspace_symbols = function(opts)
return
end
opts.ignore_filename = utils.get_default(opts.ignore_filename, false)
opts.ignore_filename = vim.F.if_nil(opts.ignore_filename, false)
pickers.new(opts, {
prompt_title = "LSP Workspace Symbols",