@@ -63,7 +63,7 @@ function! denops#plugin#register(name, ...) abort
63
63
\ ' denops#plugin#register() is deprecated. Use denops#plugin#load() instead.' ,
64
64
\)
65
65
if a: 0 is # 0 || type (a: 1 ) is # v: t_dict
66
- let l: script = s: find_plugin (a: name )
66
+ let l: script = denops#_internal#plugin#find (a: name ). script
67
67
else
68
68
let l: script = a: 1
69
69
endif
@@ -84,21 +84,19 @@ function! denops#plugin#reload(name) abort
84
84
endfunction
85
85
86
86
function ! denops#plugin#discover () abort
87
- let l: plugins = {}
88
- call s: gather_plugins (l: plugins )
87
+ let l: plugins = denops#_internal#plugin#collect ()
89
88
call denops#_internal#echo#debug (printf (' %d plugins are discovered' , len (l: plugins )))
90
- for [ l: name , l: script ] in items ( l: plugins)
91
- call denops#plugin#load (l: name , l: script )
89
+ for l: plugin in l: plugins
90
+ call denops#plugin#load (l: plugin . name, l: plugin . script )
92
91
endfor
93
92
endfunction
94
93
95
94
function ! denops#plugin#check_type (... ) abort
96
- if ! a: 0
97
- let l: plugins = {}
98
- call s: gather_plugins (l: plugins )
99
- endif
95
+ let l: plugins = a: 0
96
+ \ ? [denops#_internal#plugin#find (a: 1 )]
97
+ \ : denops#_internal#plugin#collect ()
100
98
let l: args = [g: denops #deno, ' check' ]
101
- let l: args += a: 0 ? [ s: find_plugin ( a: 1 )] : values (l: plugins )
99
+ let l: args = extend ( l: args , map (l: plugins, { _, v - > v . script }) )
102
100
let l: job = denops#_internal#job#start (l: args , {
103
101
\ ' env' : {
104
102
\ ' NO_COLOR' : 1 ,
@@ -112,27 +110,6 @@ function! denops#plugin#check_type(...) abort
112
110
\ })
113
111
endfunction
114
112
115
- function ! s: gather_plugins (plugins) abort
116
- for l: script in globpath (&runtimepath , denops#_internal#path#join ([' denops' , ' *' , ' main.ts' ]), 1 , 1 , 1 )
117
- let l: plugin = fnamemodify (l: script , ' :h:t' )
118
- if l: plugin [:0 ] == # ' @' || has_key (a: plugins , l: plugin )
119
- continue
120
- endif
121
- call extend (a: plugins , { l: plugin : l: script })
122
- endfor
123
- endfunction
124
-
125
- function ! s: find_plugin (name) abort
126
- for l: script in globpath (&runtimepath , denops#_internal#path#join ([' denops' , a: name , ' main.ts' ]), 1 , 1 , 1 )
127
- let l: name = fnamemodify (l: script , ' :h:t' )
128
- if l: name [:0 ] == # ' @' || ! filereadable (l: script )
129
- continue
130
- endif
131
- return l: script
132
- endfor
133
- throw printf (' No denops plugin for "%s" exists' , a: name )
134
- endfunction
135
-
136
113
function ! s: relay_autocmd (name) abort
137
114
let l: plugin = matchstr (expand (' <amatch>' ), ' ^[^:]\+:\zs.*' )
138
115
execute printf (' doautocmd <nomodeline> User %s:%s' , a: name , l: plugin )
0 commit comments