@@ -46,22 +46,21 @@ export async function getUi(
4646 UiOptions ,
4747 BaseParams ,
4848] > {
49- if ( options . ui . length === 0 ) {
49+ const name = options . ui ;
50+
51+ if ( name . length === 0 ) {
5052 return [
5153 undefined ,
5254 defaultUiOptions ( ) ,
5355 defaultDummy ( ) ,
5456 ] ;
5557 }
5658
57- const ui = loader . getUi ( options . ui ) ;
58- if ( ! ui ) {
59- if ( ! await loader . autoload ( denops , "ui" , options . ui ) ) {
60- await printError (
61- denops ,
62- `Not found ui: "${ options . ui } "` ,
63- ) ;
64- }
59+ if ( ! loader . getUi ( name ) && ! await loader . autoload ( denops , "ui" , name ) ) {
60+ await printError (
61+ denops ,
62+ `Not found ui: "${ options . ui } "` ,
63+ ) ;
6564
6665 return [
6766 undefined ,
@@ -70,6 +69,15 @@ export async function getUi(
7069 ] ;
7170 }
7271
72+ const ui = loader . getUi ( name ) ;
73+ if ( ! ui ) {
74+ return [
75+ undefined ,
76+ defaultUiOptions ( ) ,
77+ defaultDummy ( ) ,
78+ ] ;
79+ }
80+
7381 const [ uiOptions , uiParams ] = uiArgs ( options , ui ) ;
7482
7583 await checkUiOnInit ( ui , denops , uiOptions , uiParams ) ;
@@ -90,14 +98,24 @@ export async function getSource(
9098 ]
9199> {
92100 const name = source2Name ( userSource ) ;
101+
102+ if (
103+ ! loader . getSource ( name ) && ! await loader . autoload ( denops , "source" , name )
104+ ) {
105+ await printError (
106+ denops ,
107+ `Not found source: ${ name } ` ,
108+ ) ;
109+
110+ return [
111+ undefined ,
112+ defaultSourceOptions ( ) ,
113+ defaultDummy ( ) ,
114+ ] ;
115+ }
116+
93117 const source = loader . getSource ( name ) ;
94118 if ( ! source ) {
95- if ( ! await loader . autoload ( denops , "source" , name ) ) {
96- await printError (
97- denops ,
98- `Not found source: ${ name } ` ,
99- ) ;
100- }
101119 return [
102120 undefined ,
103121 defaultSourceOptions ( ) ,
@@ -134,26 +152,30 @@ export async function getFilter(
134152 ]
135153> {
136154 const name = filter2Name ( userFilter ) ;
137- const filter = loader . getFilter ( name ) ;
138- if ( ! filter ) {
139- if ( ! await loader . autoload ( denops , "filter" , name ) ) {
140- await printError (
141- denops ,
142- `Not found filter: ${ name } ` ,
143- ) ;
144- }
155+
156+ if (
157+ ! loader . getFilter ( name ) && ! await loader . autoload ( denops , "filter" , name )
158+ ) {
159+ await printError (
160+ denops ,
161+ `Not found filter: ${ name } ` ,
162+ ) ;
163+
145164 return [
146165 undefined ,
147166 defaultFilterOptions ( ) ,
148167 defaultDummy ( ) ,
149168 ] ;
150169 }
151170
171+ const filter = loader . getFilter ( name ) ;
172+
152173 const [ filterOptions , filterParams ] = filterArgs (
153174 filter ,
154175 options ,
155176 userFilter ,
156177 ) ;
178+
157179 await checkFilterOnInit ( filter , denops , filterOptions , filterParams ) ;
158180
159181 return [ filter , filterOptions , filterParams ] ;
0 commit comments