Skip to content

Commit

Permalink
test: set line length to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
clason committed Jul 7, 2022
1 parent 1a9b63c commit ea5f808
Show file tree
Hide file tree
Showing 25 changed files with 587 additions and 183 deletions.
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
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
27 changes: 19 additions & 8 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 @@ -477,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 @@ -966,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 @@ -1274,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 @@ -1328,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

0 comments on commit ea5f808

Please sign in to comment.