1
- local log = require (' plenary.log' ).new ({ plugin = ' ex.lsp.null -ls' })
1
+ local log = require (' plenary.log' ).new ({ plugin = ' ex.lsp.none -ls' })
2
2
3
3
-- we should be ready to three possible cases:
4
- -- * when null -ls is not loaded we should load it only on demand;
5
- -- * when null -ls is not installed we should mock it to avoid errors;
4
+ -- * when none -ls is not loaded we should load it only on demand;
5
+ -- * when none -ls is not installed we should mock it to avoid errors;
6
6
-- * when it is installed and loaded we should use it.
7
- local null_ls = setmetatable ({}, {
7
+ local none_ls = setmetatable ({}, {
8
8
__index = function (self , key )
9
- -- attempt to lazy load null -ls plugin
9
+ -- attempt to lazy load none -ls plugin
10
10
if rawget (self , ' is_installed' ) == nil then
11
- local is_installed , null_ls = pcall (require , ' null-ls' )
11
+ -- null-ls is old name of the none-ls plugin,
12
+ -- which is still used for back compatibility
13
+ local is_installed , none_ls = pcall (require , ' null-ls' )
12
14
rawset (self , ' is_installed' , is_installed )
13
- rawset (self , ' null_ls ' , null_ls )
15
+ rawset (self , ' none_ls ' , none_ls )
14
16
if is_installed then
15
17
log .debug (' none-ls is installed' )
16
18
else
@@ -19,7 +21,7 @@ local null_ls = setmetatable({}, {
19
21
end
20
22
-- return original plugin if it's installed
21
23
if rawget (self , ' is_installed' ) then
22
- return rawget (self , ' null_ls ' )[key ]
24
+ return rawget (self , ' none_ls ' )[key ]
23
25
end
24
26
-- return mock:
25
27
if key == ' get_source' then
@@ -36,19 +38,19 @@ local null_ls = setmetatable({}, {
36
38
end ,
37
39
})
38
40
39
- local NullLS = require (' lualine.ex.component' ):extend ({
41
+ local NoneLS = require (' lualine.ex.component' ):extend ({
40
42
icon = ' ' ,
41
43
query = function ()
42
44
return { filetype = vim .bo .filetype }
43
45
end ,
44
- component_name = ' ex_lsp_null_ls ' ,
46
+ component_name = ' ex_lsp_none_ls ' ,
45
47
source_names_separator = ' ,' ,
46
48
is_enabled = function (component )
47
- return null_ls .is_registered (component :get_query ())
49
+ return none_ls .is_registered (component :get_query ())
48
50
end ,
49
51
})
50
52
51
- function NullLS :get_query ()
53
+ function NoneLS :get_query ()
52
54
if type (self .options .query ) == ' function' then
53
55
return self .options .query ()
54
56
else
@@ -57,8 +59,8 @@ function NullLS:get_query()
57
59
end
58
60
59
61
-- get sources by query, and concatenate their unique names with {source_names_separator}
60
- function NullLS :update_status ()
61
- local sources = null_ls .get_source (self :get_query ())
62
+ function NoneLS :update_status ()
63
+ local sources = none_ls .get_source (self :get_query ())
62
64
log .fmt_debug (
63
65
' For query %s was found sources: %s' ,
64
66
vim .inspect (self .options .query ),
@@ -77,4 +79,4 @@ function NullLS:update_status()
77
79
return table.concat (names , self .options .source_names_separator )
78
80
end
79
81
80
- return NullLS
82
+ return NoneLS
0 commit comments