From 1b8db9afc21ade35eb38b1c71c2e4946e7170ac6 Mon Sep 17 00:00:00 2001 From: Robert Morrison Date: Mon, 17 Apr 2023 18:38:11 +0100 Subject: [PATCH] fix(log): remove LSP warnings from log.lua Minor changes to log.lua to remove potential issues made apparent by the LSP. --- lua/tjdevries/log.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/tjdevries/log.lua b/lua/tjdevries/log.lua index a51d077..a4dd9f8 100644 --- a/lua/tjdevries/log.lua +++ b/lua/tjdevries/log.lua @@ -2,6 +2,7 @@ -- -- Inspired by rxi/log.lua -- Modified by tjdevries and can be found at github.com/tjdevries/vlog.nvim +-- Further modified by sherlock5512 as part of these dotfiles -- -- This library is free software; you can redistribute it and/or modify it -- under the terms of the MIT license. See LICENSE for details. @@ -109,6 +110,7 @@ log.new = function(config, standalone) vim.cmd(string.format("echohl %s", level_config.hl)) end +---@diagnostic disable-next-line: missing-parameter -- This function can be called with only two parameters local split_console = vim.split(console_string, "\n") for _, v in ipairs(split_console) do vim.cmd(string.format([[echom "[%s] %s"]], config.plugin, vim.fn.escape(v, '"'))) @@ -121,7 +123,7 @@ log.new = function(config, standalone) -- Output to log file if config.use_file then - local fp = io.open(outfile, "a") + local fp = assert(io.open(outfile, "a"),"Could not open " .. outfile .. "!") local str = string.format("[%-6s%s] %s: %s\n", nameupper, os.date(), lineinfo, msg) fp:write(str)