Skip to content

Commit 032c640

Browse files
feat: include icon provider warning in health check
## Details Improves visibility into cause of missing language icons by informing users what icons provider (mini or nvim-web-devicons) is being used if there is one. Produces a warning if none is available. Related issue: #270 Also updates blink.cmp setup following most recent changes.
1 parent ba6253d commit 032c640

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,13 @@ cmp.setup({
136136
```lua
137137
require('blink.cmp').setup({
138138
sources = {
139-
completion = {
140-
enabled_providers = { 'lsp', 'path', 'snippets', 'buffer', 'markdown' },
141-
},
139+
default = { 'lsp', 'path', 'snippets', 'buffer', 'markdown' },
142140
providers = {
143-
markdown = { name = 'RenderMarkdown', module = 'render-markdown.integ.blink' },
141+
markdown = {
142+
name = 'RenderMarkdown',
143+
module = 'render-markdown.integ.blink',
144+
fallbacks = { 'lsp' },
145+
},
144146
},
145147
},
146148
})

doc/render-markdown.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For 0.10.0 Last change: 2024 December 24
1+
*render-markdown.txt* For 0.10.0 Last change: 2024 December 29
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*
@@ -189,11 +189,13 @@ BLINK.CMP *render-markdown-completions-blink.cmp*
189189
>lua
190190
require('blink.cmp').setup({
191191
sources = {
192-
completion = {
193-
enabled_providers = { 'lsp', 'path', 'snippets', 'buffer', 'markdown' },
194-
},
192+
default = { 'lsp', 'path', 'snippets', 'buffer', 'markdown' },
195193
providers = {
196-
markdown = { name = 'RenderMarkdown', module = 'render-markdown.integ.blink' },
194+
markdown = {
195+
name = 'RenderMarkdown',
196+
module = 'render-markdown.integ.blink',
197+
fallbacks = { 'lsp' },
198+
},
197199
},
198200
},
199201
})

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ generate:
2828
python scripts/generate.py
2929

3030
health:
31-
nvim -c "checkhealth render-markdown" -- .
31+
nvim -c "checkhealth render-markdown" -- -
3232

3333
cat-log:
3434
cat ~/.local/state/nvim/render-markdown.log

lua/render-markdown/health.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
local Icons = require('render-markdown.lib.icons')
12
local state = require('render-markdown.state')
23

34
---@class render.md.Health
45
local M = {}
56

67
---@private
7-
M.version = '7.7.5'
8+
M.version = '7.7.6'
89

910
function M.check()
1011
M.start('version')
@@ -38,6 +39,14 @@ function M.check()
3839
vim.health.error('not installed')
3940
end
4041

42+
M.start('icons')
43+
local provider = Icons.provider()
44+
if provider ~= nil then
45+
vim.health.ok('using: ' .. provider)
46+
else
47+
vim.health.warn('none installed')
48+
end
49+
4150
M.start('executables')
4251
if latex.enabled then
4352
M.check_executable(latex.converter, latex_advice)

lua/render-markdown/lib/icons.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,15 @@ function M.get(language)
2020
end
2121
end
2222

23+
---@return string?
24+
function M.provider()
25+
if has_mini_icons then
26+
return 'mini.icons'
27+
elseif has_devicons then
28+
return 'nvim-web-devicons'
29+
else
30+
return nil
31+
end
32+
end
33+
2334
return M

0 commit comments

Comments
 (0)