-
Notifications
You must be signed in to change notification settings - Fork 34
/
config.lua
120 lines (113 loc) · 3.73 KB
/
config.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
local M = {
--- @type Configuration
opts = {},
}
--- @class Configuration
--- @field auto_reload boolean
--- @field auto_reload_timeout_ms integer
--- @field commands boolean
--- @field highlights HighlightConfig
--- @field load_coverage_cb fun(ftype: string)
--- @field signs SignsConfig
--- @field sign_group string name of the sign group (:h sign_placelist)
--- @field summary SummaryOpts
--- @field lang table
local defaults = {
auto_reload = false,
auto_reload_timeout_ms = 500,
commands = true,
--- @class HighlightConfig
--- @field covered Highlight
--- @field uncovered Highlight
--- @field partial Highlight
--- @field summary_border Highlight
--- @field summary_normal Highlight
--- @field summary_cursor_line Highlight
--- @field summary_header Highlight
--- @field summary_pass Highlight
--- @field summary_fail Highlight
highlights = {
covered = { fg = "#B7F071" },
uncovered = { fg = "#F07178" },
partial = { fg = "#AA71F0" },
summary_border = { link = "FloatBorder" },
summary_normal = { link = "NormalFloat" },
summary_cursor_line = { link = "CursorLine" },
summary_header = { style = "bold,underline", sp = "fg" },
summary_pass = { link = "CoverageCovered" },
summary_fail = { link = "CoverageUncovered" },
},
load_coverage_cb = nil,
--- @class SignsConfig
--- @field covered Sign
--- @field uncovered Sign
--- @field partial Sign
signs = {
covered = { hl = "CoverageCovered", text = "▎" },
uncovered = { hl = "CoverageUncovered", text = "▎" },
partial = { hl = "CoveragePartial", text = "▎" },
},
sign_group = "coverage",
--- @class SummaryOpts
--- @field width_percentage number
--- @field height_percentage number
--- @field min_coverage number
summary = {
width_percentage = 0.70,
height_percentage = 0.50,
borders = {
topleft = "╭",
topright = "╮",
top = "─",
left = "│",
right = "│",
botleft = "╰",
botright = "╯",
bot = "─",
highlight = "Normal:CoverageSummaryBorder",
},
min_coverage = 80.0,
},
-- language specific configuration
lang = {
dart = {
coverage_file = "coverage/lcov.info",
},
go = {
coverage_file = "coverage.out",
},
javascript = {
coverage_file = "coverage/lcov.info",
},
julia = {
-- See https://github.com/julia-actions/julia-processcoverage
coverage_command = "julia --compile=min -O0 -e '" .. [[
!isdir("src") && (print(stderr, "No src directory found."); exit(1))
push!(empty!(LOAD_PATH), "@nvim-coverage", "@stdlib")
using CoverageTools
LCOV.writefile("lcov.info", process_folder("src"))
]] .. "'",
coverage_file = "lcov.info",
},
python = {
coverage_file = ".coverage",
coverage_command = "coverage json --fail-under=0 -q -o -",
},
ruby = {
coverage_file = "coverage/coverage.json",
},
rust = {
coverage_command = "grcov ${cwd} -s ${cwd} --binary-path ./target/debug/ -t coveralls --branch --ignore-not-existing --token NO_TOKEN",
project_files_only = true,
project_files = { "src/*", "tests/*" },
},
},
}
--- Setup configuration values.
M.setup = function(config)
M.opts = vim.tbl_deep_extend("force", M.opts, defaults)
if config ~= nil then
M.opts = vim.tbl_deep_extend("force", M.opts, config)
end
end
return M