Skip to content

Commit

Permalink
chore: styling
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarriga committed Jun 9, 2024
1 parent ef1837e commit 7969e0a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lua/nio/logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Logger.new(filename, opts)
local log_info = vim.loop.fs_stat(logger._filename)
if log_info and log_info.size > LARGE then
local warn_msg =
string.format("Nio log is large (%d MB): %s", log_info.size / (1000 * 1000), logger._filename)
string.format("Nio log is large (%d MB): %s", log_info.size / (1000 * 1000), logger._filename)
vim.notify(warn_msg, vim.log.levels.WARN)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/nio/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local M = {}

function M.tbl_flatten(t)
return vim.fn.has("nvim-0.11") == 1 and vim.iter(t):flatten(math.huge):totable()
or vim.tbl_flatten(t)
or vim.tbl_flatten(t)
end

return M
17 changes: 11 additions & 6 deletions scripts/generate_lsp_types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,15 @@ function Generator:request(request)

lines[#lines + 1] = "---@async"
if request.params then
lines[#lines + 1] = ("---@param args %s Arguments to the request"):format(self:type_name(request.params))
lines[#lines + 1] = ("---@param args %s Arguments to the request"):format(
self:type_name(request.params)
)
end
lines[#lines + 1] = "---@param bufnr integer? Buffer number (0 for current buffer)"
lines[#lines + 1] = "---@param opts? nio.lsp.RequestOpts Options for the request handling"
lines[#lines + 1] = ("---@return %s.ResponseError|nil error The error object in case a request fails."):format(self:type_prefix())
lines[#lines + 1] = ("---@return %s.ResponseError|nil error The error object in case a request fails."):format(
self:type_prefix()
)
if request.result then
lines[#lines + 1] = (("---@return %s"):format(self:type_name(request.result)))
if not vim.endswith(lines[#lines], "|nil") then
Expand All @@ -397,7 +401,7 @@ function Generator:request(request)
self:convert_method_name(request.method),
request.params and "args, " or ""
)
)
)
lines[#lines + 1] = ""
return lines
end
Expand All @@ -418,7 +422,7 @@ function Generator:notification(notification)
self:convert_method_name(notification.method),
notification.params and "args" or ""
)
)
)
lines[#lines + 1] = ""
end
return lines
Expand All @@ -442,7 +446,7 @@ function Generator:enumeration(enum)
"|"
)
)
)
)
lines[#lines + 1] = ""
return lines
end
Expand Down Expand Up @@ -481,7 +485,8 @@ function Generator:generate()
})
print("Generating notifications")
for _, notification in ipairs(self.model.notifications) do
if notification.messageDirection == "clientToServer" or notification.messageDirection == "both"
if
notification.messageDirection == "clientToServer" or notification.messageDirection == "both"
then
vim.list_extend(lines, self:notification(notification))
end
Expand Down

0 comments on commit 7969e0a

Please sign in to comment.