Skip to content

Commit

Permalink
Add ddu#load()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jul 6, 2023
1 parent 2c8c78b commit 67f9aef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
4 changes: 4 additions & 0 deletions autoload/ddu.vim
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ endfunction
function ddu#register(type, path) abort
call ddu#_notify('register', [a:type, a:path])
endfunction
function ddu#load(type, names) abort
call ddu#_notify('loadExtensions', [a:type, a:names])
endfunction


function ddu#_request(method, args) abort
if s:init()
Expand Down
2 changes: 1 addition & 1 deletion autoload/ddu/custom.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ddu#custom#load_config(path) abort
return
endif

return s:request('loadConfig', [a:path])
return s:notify('loadConfig', [a:path])
endfunction

let s:aliases = #{
Expand Down
8 changes: 8 additions & 0 deletions denops/ddu/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ export function main(denops: Denops) {
});
return Promise.resolve();
},
async loadExtensions(arg1: unknown, arg2: unknown): Promise<void> {
const type = ensure(arg1, is.String) as DduExtType;
const names = ensure(arg2, is.ArrayOf(is.String));
for (const name of names) {
await loader.autoload(denops, type, name);
}
return Promise.resolve();
},
async start(arg1: unknown): Promise<void> {
await lock.lock(async () => {
let userOptions = ensure(arg1, is.Record);
Expand Down
24 changes: 12 additions & 12 deletions doc/ddu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ ddu#item_action({name}, {action}, {items}, {params})

NOTE: It is for creating UI interface.

*ddu#load()*
ddu#load({type}, {names})
Load ddu extensions.
{type} is "ui" or "source" or "filter" or "kind" or "column".
{names} is array of extension name.

*ddu#pop()*
ddu#pop({name}[, {opt}])
Restore the previous state.
Expand Down Expand Up @@ -437,6 +443,9 @@ ddu#custom#load_config({path})
NOTE: {path} must be full path.
NOTE: The loading is asynchronous.

*ddu#custom#load_extensions()*
ddu#custom#load_extensions({path})

*ddu#custom#patch_global()*
ddu#custom#patch_global({option-name}, {value})
ddu#custom#patch_global({dict})
Expand Down Expand Up @@ -1324,18 +1333,9 @@ feature.

https://github.com/vim-denops/denops.vim#shared-server

Or you can use dummy |ddu#start()| for it. >
call timer_start(10, { _ ->
\ ddu#start(#{
\ ui: 'ff',
\ uiParams: #{
\ ff: #{
\ ignoreEmpty: v:true,
\ },
\ },
\ })
\ })
Or you can use |ddu#load()| for it.
>
call timer_start(10, { _ -> ddu#load('ui', ['ff']) })
<
*ddu-faq-6*
Q: |:cnext| / |:cprevious| like commands are available?
Expand Down

0 comments on commit 67f9aef

Please sign in to comment.