Skip to content

Commit 135d4e9

Browse files
committed
build: selene + stylua
1 parent 0f58468 commit 135d4e9

File tree

15 files changed

+950
-825
lines changed

15 files changed

+950
-825
lines changed

lua/trouble/colors.lua

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
local M = {}
22

33
local links = {
4-
Error = "LspDiagnosticsDefaultError",
5-
Warning = "LspDiagnosticsDefaultWarning",
6-
Information = "LspDiagnosticsDefaultInformation",
7-
Hint = "LspDiagnosticsDefaultHint",
8-
SignError = "LspDiagnosticsSignError",
9-
SignWarning = "LspDiagnosticsSignWarning",
10-
SignInformation = "LspDiagnosticsSignInformation",
11-
SignHint = "LspDiagnosticsSignHint",
12-
TextError = "LspTroubleText",
13-
TextWarning = "LspTroubleText",
14-
TextInformation = "LspTroubleText",
15-
TextHint = "LspTroubleText",
16-
Text = "Normal",
17-
File = "Directory",
18-
Source = "Comment",
19-
Code = "Comment",
20-
Location = "LineNr",
21-
FoldIcon = "CursorLineNr",
22-
Normal = "Normal",
23-
Count = "TabLineSel",
24-
Preview = "Search",
25-
Indent = "LineNr",
26-
SignOther = "LspTroubleSignInformation"
4+
Error = "LspDiagnosticsDefaultError",
5+
Warning = "LspDiagnosticsDefaultWarning",
6+
Information = "LspDiagnosticsDefaultInformation",
7+
Hint = "LspDiagnosticsDefaultHint",
8+
SignError = "LspDiagnosticsSignError",
9+
SignWarning = "LspDiagnosticsSignWarning",
10+
SignInformation = "LspDiagnosticsSignInformation",
11+
SignHint = "LspDiagnosticsSignHint",
12+
TextError = "LspTroubleText",
13+
TextWarning = "LspTroubleText",
14+
TextInformation = "LspTroubleText",
15+
TextHint = "LspTroubleText",
16+
Text = "Normal",
17+
File = "Directory",
18+
Source = "Comment",
19+
Code = "Comment",
20+
Location = "LineNr",
21+
FoldIcon = "CursorLineNr",
22+
Normal = "Normal",
23+
Count = "TabLineSel",
24+
Preview = "Search",
25+
Indent = "LineNr",
26+
SignOther = "LspTroubleSignInformation",
2727
}
2828

2929
function M.setup()
30-
for k, v in pairs(links) do
31-
vim.api.nvim_command('hi def link LspTrouble' .. k .. ' ' .. v)
32-
vim.api.nvim_command('hi def link Trouble' .. k .. ' LspTrouble' .. k)
33-
end
30+
for k, v in pairs(links) do
31+
vim.api.nvim_command("hi def link LspTrouble" .. k .. " " .. v)
32+
vim.api.nvim_command("hi def link Trouble" .. k .. " LspTrouble" .. k)
33+
end
3434
end
3535

3636
return M

lua/trouble/config.lua

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,64 @@ M.namespace = vim.api.nvim_create_namespace("Trouble")
55
---@class Options
66
---@field buf number|nil
77
---@field win number|nil
8+
-- TODO: make some options configurable per mode
9+
-- TODO: make it possible to have multiple trouble lists open at the same time
810
local defaults = {
9-
debug = false,
10-
position = "bottom", -- position of the list can be: bottom, top, left, right
11-
height = 10, -- height of the trouble list when position is top or bottom
12-
width = 50, -- width of the list when position is left or right
13-
icons = true, -- use devicons for filenames
14-
mode = "lsp_workspace_diagnostics", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist"
15-
fold_open = "", -- icon used for open folds
16-
fold_closed = "", -- icon used for closed folds
17-
action_keys = { -- key mappings for actions in the trouble list
18-
close = "q", -- close the list
19-
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
20-
refresh = "r", -- manually refresh
21-
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
22-
jump_close = {"o"}, -- jump to the diagnostic and close the list
23-
toggle_mode = "m", -- toggle between "workspace" and "document" mode
24-
toggle_preview = "P", -- toggle auto_preview
25-
hover = "K", -- opens a small poup with the full multiline message
26-
preview = "p", -- preview the diagnostic location
27-
close_folds = {"zM", "zm"}, -- close all folds
28-
open_folds = {"zR", "zr"}, -- open all folds
29-
toggle_fold = {"zA", "za"}, -- toggle fold of current file
30-
previous = "k", -- preview item
31-
next = "j" -- next item
32-
},
33-
indent_lines = true, -- add an indent guide below the fold icons
34-
auto_open = false, -- automatically open the list when you have diagnostics
35-
auto_close = false, -- automatically close the list when you have no diagnostics
36-
auto_preview = true, -- automatyically preview the location of the diagnostic. <esc> to close preview and go back to last window
37-
auto_fold = false, -- automatically fold a file trouble list at creation
38-
signs = {
39-
-- icons / text used for a diagnostic
40-
error = "",
41-
warning = "",
42-
hint = "",
43-
information = "",
44-
other = ""
45-
},
46-
use_lsp_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
11+
debug = false,
12+
position = "bottom", -- position of the list can be: bottom, top, left, right
13+
height = 10, -- height of the trouble list when position is top or bottom
14+
width = 50, -- width of the list when position is left or right
15+
icons = true, -- use devicons for filenames
16+
mode = "lsp_workspace_diagnostics", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist"
17+
fold_open = "", -- icon used for open folds
18+
fold_closed = "", -- icon used for closed folds
19+
action_keys = { -- key mappings for actions in the trouble list
20+
close = "q", -- close the list
21+
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
22+
refresh = "r", -- manually refresh
23+
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
24+
jump_close = { "o" }, -- jump to the diagnostic and close the list
25+
toggle_mode = "m", -- toggle between "workspace" and "document" mode
26+
toggle_preview = "P", -- toggle auto_preview
27+
hover = "K", -- opens a small poup with the full multiline message
28+
preview = "p", -- preview the diagnostic location
29+
close_folds = { "zM", "zm" }, -- close all folds
30+
open_folds = { "zR", "zr" }, -- open all folds
31+
toggle_fold = { "zA", "za" }, -- toggle fold of current file
32+
previous = "k", -- preview item
33+
next = "j", -- next item
34+
},
35+
indent_lines = true, -- add an indent guide below the fold icons
36+
auto_open = false, -- automatically open the list when you have diagnostics
37+
auto_close = false, -- automatically close the list when you have no diagnostics
38+
auto_preview = true, -- automatyically preview the location of the diagnostic. <esc> to close preview and go back to last window
39+
auto_fold = false, -- automatically fold a file trouble list at creation
40+
signs = {
41+
-- icons / text used for a diagnostic
42+
error = "",
43+
warning = "",
44+
hint = "",
45+
information = "",
46+
other = "",
47+
},
48+
use_lsp_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
4749
}
4850

4951
---@type Options
5052
M.options = {}
5153

5254
---@return Options
5355
function M.setup(options)
54-
M.options = vim.tbl_deep_extend("force", {}, defaults, options or {})
55-
M.fix_mode(M.options)
56+
M.options = vim.tbl_deep_extend("force", {}, defaults, options or {})
57+
M.fix_mode(M.options)
5658
end
5759

5860
function M.fix_mode(opts)
59-
if opts.mode == "workspace" then
60-
opts.mode = "lsp_workspace_diagnostics"
61-
elseif opts.mode == "document" then
62-
opts.mode = "lsp_document_diagnostics"
63-
end
61+
if opts.mode == "workspace" then
62+
opts.mode = "lsp_workspace_diagnostics"
63+
elseif opts.mode == "document" then
64+
opts.mode = "lsp_document_diagnostics"
65+
end
6466
end
6567

6668
M.setup()

lua/trouble/folds.lua

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ local M = {}
55
M.folded = {}
66

77
function M.is_folded(filename)
8-
local fold = M.folded[filename]
9-
return (fold == nil and config.options.auto_fold == true) or (fold == true)
8+
local fold = M.folded[filename]
9+
return (fold == nil and config.options.auto_fold == true) or (fold == true)
1010
end
1111

12-
function M.toggle(filename) M.folded[filename] = not M.is_folded(filename) end
12+
function M.toggle(filename)
13+
M.folded[filename] = not M.is_folded(filename)
14+
end
1315

14-
function M.close(filename) M.folded[filename] = true end
16+
function M.close(filename)
17+
M.folded[filename] = true
18+
end
1519

16-
function M.open(filename) M.folded[filename] = false end
20+
function M.open(filename)
21+
M.folded[filename] = false
22+
end
1723

1824
return M

0 commit comments

Comments
 (0)