forked from nvim-lua/completion-nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealth.lua
More file actions
56 lines (50 loc) · 1.88 KB
/
health.lua
File metadata and controls
56 lines (50 loc) · 1.88 KB
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
local vim = vim
local api = vim.api
local source = require'source'
local health_start = vim.fn["health#report_start"]
local health_ok = vim.fn['health#report_ok']
local health_info = vim.fn['health#report_info']
local health_error = vim.fn['health#report_error']
local M = {}
local checkCompletionSource = function()
source.checkHealth()
end
local checkSnippetSource = function()
local snippet_source = vim.g.completion_enable_snippet
if snippet_source == nil then
health_info("You haven't setup any snippet source.")
elseif snippet_source == 'UltiSnips' then
if string.match(api.nvim_get_option("rtp"), ".*ultisnips.*") then
health_ok("You are using UltiSnips as your snippet source")
else
health_error("UltiSnips is not available! Check if you install Ultisnips correctly.")
end
elseif snippet_source == 'Neosnippet' then
if string.match(api.nvim_get_option("rtp"), ".*neosnippet.vim.*") == 1 then
health_ok("You are using Neosnippet as your snippet source")
else
health_error("Neosnippet is not available! Check if you install Neosnippet correctly.")
end
elseif snippet_source == 'vim-vsnip' then
if string.match(api.nvim_get_option("rtp"), ".*vsnip.*") then
health_ok("You are using vim-vsnip as your snippet source")
else
health_error("vim-vsnip is not available! Check if you install vim-vsnip correctly.")
end
else
health_error("You're snippet source is not available! possible value are: UltiSnips, Neosnippet, vim-vsnip")
end
end
function M.checkHealth()
health_start("general")
if vim.tbl_filter == nil then
health_error("vim.tbl_filter is not found!", {'consider recompile neovim from the latest master branch'})
else
health_ok("neovim version is supported")
end
health_start("completion source")
checkCompletionSource()
health_start("snippet source")
checkSnippetSource()
end
return M