Skip to content

chore: reformat with stylua 0.14.0 #19264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stylua.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
column_width = 120
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
Expand Down
3 changes: 1 addition & 2 deletions runtime/doc/lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2094,8 +2094,7 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
Lua module: vim.lsp.sync *lsp-sync*

*vim.lsp.sync.compute_diff()*
compute_diff({prev_lines}, {curr_lines}, {firstline}, {lastline},
{new_lastline}, {offset_encoding}, {line_ending})
compute_diff({___MissingCloseParenHere___})
Returns the range table for the difference between prev and
curr lines

Expand Down
13 changes: 11 additions & 2 deletions runtime/lua/vim/_editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,12 @@ function vim._cs_remote(rcid, server_addr, connect_error, args)
f_tab = true
elseif subcmd == 'silent' then
f_silent = true
elseif subcmd == 'wait' or subcmd == 'wait-silent' or subcmd == 'tab-wait' or subcmd == 'tab-wait-silent' then
elseif
subcmd == 'wait'
or subcmd == 'wait-silent'
or subcmd == 'tab-wait'
or subcmd == 'tab-wait-silent'
then
return { errmsg = 'E5600: Wait commands not yet implemented in nvim' }
elseif subcmd == 'tab-silent' then
f_tab = true
Expand Down Expand Up @@ -795,7 +800,11 @@ function vim.deprecate(name, alternative, version, plugin, backtrace)
local message = name .. ' is deprecated'
plugin = plugin or 'Nvim'
message = alternative and (message .. ', use ' .. alternative .. ' instead.') or message
message = message .. ' See :h deprecated\nThis function will be removed in ' .. plugin .. ' version ' .. version
message = message
.. ' See :h deprecated\nThis function will be removed in '
.. plugin
.. ' version '
.. version
if vim.notify_once(message, vim.log.levels.WARN) and backtrace ~= false then
vim.notify(debug.traceback('', 2):sub(2), vim.log.levels.WARN)
end
Expand Down
23 changes: 18 additions & 5 deletions runtime/lua/vim/_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ do -- buffer option accessor
if type(k) == 'string' then
_setup()
if win_options[k] then
error(string.format([['%s' is a window option, not a buffer option. See ":help %s"]], k, k))
error(
string.format([['%s' is a window option, not a buffer option. See ":help %s"]], k, k)
)
elseif glb_options[k] then
error(string.format([['%s' is a global option, not a buffer option. See ":help %s"]], k, k))
error(
string.format([['%s' is a global option, not a buffer option. See ":help %s"]], k, k)
)
end
end

Expand Down Expand Up @@ -132,9 +136,13 @@ do -- window option accessor
if type(k) == 'string' then
_setup()
if buf_options[k] then
error(string.format([['%s' is a buffer option, not a window option. See ":help %s"]], k, k))
error(
string.format([['%s' is a buffer option, not a window option. See ":help %s"]], k, k)
)
elseif glb_options[k] then
error(string.format([['%s' is a global option, not a window option. See ":help %s"]], k, k))
error(
string.format([['%s' is a global option, not a window option. See ":help %s"]], k, k)
)
end
end

Expand Down Expand Up @@ -252,7 +260,12 @@ local function assert_valid_value(name, value, types)
end

error(
string.format("Invalid option type '%s' for '%s', should be %s", type_of_value, name, table.concat(types, ' or '))
string.format(
"Invalid option type '%s' for '%s', should be %s",
type_of_value,
name,
table.concat(types, ' or ')
)
)
end

Expand Down
36 changes: 21 additions & 15 deletions runtime/lua/vim/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ local all_namespaces = {}
---@private
local function to_severity(severity)
if type(severity) == 'string' then
return assert(M.severity[string.upper(severity)], string.format('Invalid severity: %s', severity))
return assert(
M.severity[string.upper(severity)],
string.format('Invalid severity: %s', severity)
)
end
return severity
end
Expand Down Expand Up @@ -277,7 +280,8 @@ local function set_diagnostic_cache(namespace, bufnr, diagnostics)
for _, diagnostic in ipairs(diagnostics) do
assert(diagnostic.lnum, 'Diagnostic line number is required')
assert(diagnostic.col, 'Diagnostic column is required')
diagnostic.severity = diagnostic.severity and to_severity(diagnostic.severity) or M.severity.ERROR
diagnostic.severity = diagnostic.severity and to_severity(diagnostic.severity)
or M.severity.ERROR
diagnostic.end_lnum = diagnostic.end_lnum or diagnostic.lnum
diagnostic.end_col = diagnostic.end_col or diagnostic.col
diagnostic.namespace = namespace
Expand Down Expand Up @@ -322,13 +326,8 @@ local function save_extmarks(namespace, bufnr)
})
diagnostic_attached_buffers[bufnr] = true
end
diagnostic_cache_extmarks[bufnr][namespace] = vim.api.nvim_buf_get_extmarks(
bufnr,
namespace,
0,
-1,
{ details = true }
)
diagnostic_cache_extmarks[bufnr][namespace] =
vim.api.nvim_buf_get_extmarks(bufnr, namespace, 0, -1, { details = true })
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is nice!


local registered_autocmds = {}
Expand Down Expand Up @@ -482,7 +481,8 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
bufnr = get_bufnr(bufnr)
local wrap = vim.F.if_nil(opts.wrap, true)
local line_count = vim.api.nvim_buf_line_count(bufnr)
local diagnostics = get_diagnostics(bufnr, vim.tbl_extend('keep', opts, { namespace = namespace }), true)
local diagnostics =
get_diagnostics(bufnr, vim.tbl_extend('keep', opts, { namespace = namespace }), true)
local line_diagnostics = diagnostic_lines(diagnostics)
for i = 0, line_count do
local offset = i * (search_forward and 1 or -1)
Expand Down Expand Up @@ -971,7 +971,10 @@ M.handlers.virtual_text = {
if opts.virtual_text.format then
diagnostics = reformat_diagnostics(opts.virtual_text.format, diagnostics)
end
if opts.virtual_text.source and (opts.virtual_text.source ~= 'if_many' or count_sources(bufnr) > 1) then
if
opts.virtual_text.source
and (opts.virtual_text.source ~= 'if_many' or count_sources(bufnr) > 1)
then
diagnostics = prefix_source(diagnostics)
end
if opts.virtual_text.severity then
Expand Down Expand Up @@ -1279,7 +1282,9 @@ function M.open_float(opts, ...)
-- LSP servers can send diagnostics with `end_col` past the length of the line
local line_length = #vim.api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
diagnostics = vim.tbl_filter(function(d)
return d.lnum == lnum and math.min(d.col, line_length - 1) <= col and (d.end_col >= col or d.end_lnum > lnum)
return d.lnum == lnum
and math.min(d.col, line_length - 1) <= col
and (d.end_col >= col or d.end_lnum > lnum)
end, diagnostics)
end

Expand Down Expand Up @@ -1333,9 +1338,10 @@ function M.open_float(opts, ...)
diagnostics = prefix_source(diagnostics)
end

local prefix_opt = if_nil(opts.prefix, (scope == 'cursor' and #diagnostics <= 1) and '' or function(_, i)
return string.format('%d. ', i)
end)
local prefix_opt =
if_nil(opts.prefix, (scope == 'cursor' and #diagnostics <= 1) and '' or function(_, i)
return string.format('%d. ', i)
end)

local prefix, prefix_hl_group
if prefix_opt then
Expand Down
8 changes: 6 additions & 2 deletions runtime/lua/vim/filetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ local extension = {
bsdl = 'bsdl',
bst = 'bst',
btm = function(path, bufnr)
return (vim.g.dosbatch_syntax_for_btm and vim.g.dosbatch_syntax_for_btm ~= 0) and 'dosbatch' or 'btm'
return (vim.g.dosbatch_syntax_for_btm and vim.g.dosbatch_syntax_for_btm ~= 0) and 'dosbatch'
or 'btm'
end,
bzl = 'bzl',
bazel = 'bzl',
Expand Down Expand Up @@ -2169,7 +2170,10 @@ local function sort_by_priority(t)
local sorted = {}
for k, v in pairs(t) do
local ft = type(v) == 'table' and v[1] or v
assert(type(ft) == 'string' or type(ft) == 'function', 'Expected string or function for filetype')
assert(
type(ft) == 'string' or type(ft) == 'function',
'Expected string or function for filetype'
)

local opts = (type(v) == 'table' and type(v[2]) == 'table') and v[2] or {}
if not opts.priority then
Expand Down
Loading