Skip to content

Commit

Permalink
refactor: logging
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 2, 2021
1 parent 9111a5e commit d7c915a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 0 additions & 4 deletions lua/trouble/colors.lua
Expand Up @@ -25,10 +25,6 @@ local links = {
Indent = "LineNr"
}

-- for key, value in pairs(links) do
-- print("| **LspTrouble" .. key .. "* | " .. value .. " |")
-- end

function M.setup()
for k, v in pairs(links) do
vim.api.nvim_command('hi def link LspTrouble' .. k .. ' ' .. v)
Expand Down
1 change: 1 addition & 0 deletions lua/trouble/config.lua
Expand Up @@ -4,6 +4,7 @@ M.namespace = vim.api.nvim_create_namespace('LspTrouble')

---@class Options
local defaults = {
debug = true,
height = 10, -- height of the trouble list
icons = true, -- use devicons for filenames
mode = "workspace", -- "workspace" or "document"
Expand Down
7 changes: 4 additions & 3 deletions lua/trouble/util.lua
@@ -1,3 +1,5 @@
local config = require("trouble.config")

local M = {}

function M.count(tab)
Expand All @@ -8,11 +10,10 @@ end

function M.log(msg, hl)
hl = hl or "MsgArea"
vim.api.nvim_command('echohl ' .. hl)
vim.api.nvim_command("echom '[LspTrouble] " .. msg:gsub("'", "''") .. "'")
vim.api.nvim_command('echohl None')
vim.api.nvim_echo({{'[LspTrouble] ', hl}, {msg}}, true, {})
end

function M.warn(msg) M.log(msg, "WarningMsg") end

function M.debug(msg) if config.options.debug then M.log(msg) end end
return M

0 comments on commit d7c915a

Please sign in to comment.