@@ -61,6 +61,7 @@ function docs.show_item(item)
61
61
table.insert (doc_lines , s )
62
62
end
63
63
table.insert (doc_lines , ' ```' )
64
+ table.insert (doc_lines , ' ---' )
64
65
end
65
66
66
67
local doc = type (item .documentation ) == ' string' and item .documentation or item .documentation .value
@@ -70,15 +71,22 @@ function docs.show_item(item)
70
71
vim .api .nvim_buf_set_lines (docs .win :get_buf (), 0 , - 1 , true , doc_lines )
71
72
vim .api .nvim_set_option_value (' modified' , false , { buf = docs .win :get_buf () })
72
73
73
- local filetype = item .documentation .kind == ' markdown' and ' markdown' or ' plaintext'
74
- if filetype ~= vim .api .nvim_get_option_value (' filetype' , { buf = docs .win :get_buf () }) then
75
- vim .api .nvim_set_option_value (' filetype' , filetype , { buf = docs .win :get_buf () })
76
- end
77
-
78
74
if autocomplete .win :get_win () then
79
75
docs .win :open ()
80
76
docs .update_position ()
81
77
end
78
+
79
+ -- use the built-in markdown styling
80
+ -- NOTE: according to https://github.com/Saghen/blink.cmp/pull/33#issuecomment-2400195950
81
+ -- it's possible for this to fail so we call it safely
82
+ pcall (
83
+ function ()
84
+ vim .lsp .util .stylize_markdown (docs .win :get_buf (), doc_lines , {
85
+ height = vim .api .nvim_win_get_height (docs .win :get_win ()),
86
+ width = vim .api .nvim_win_get_width (docs .win :get_win ()),
87
+ })
88
+ end
89
+ )
82
90
end )
83
91
end
84
92
0 commit comments