Skip to content

Commit

Permalink
Add ddu#custom#get_source_names() and ddu#custom#get_alias_names()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jun 21, 2023
1 parent 83d1eeb commit 013f4b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions autoload/ddu/custom.vim
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ endfunction
function ddu#custom#get_current(name) abort
return ddu#_request('getCurrent', [a:name])
endfunction
function ddu#custom#get_source_names() abort
return ddu#_request('getSourceNames', [])
endfunction
function ddu#custom#get_alias_names(type) abort
return ddu#_request('getAliasNames', [a:type])
endfunction

function s:normalize_key_or_dict(key_or_dict, value) abort
if a:key_or_dict->type() == v:t_dict
Expand Down
6 changes: 6 additions & 0 deletions denops/ddu/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ export function main(denops: Denops) {
const ddu = getDdu(name);
return Promise.resolve(ddu.getContext());
},
getSourceNames(): Promise<string[]> {
return Promise.resolve(loader.getSourceNames());
},
getAliasNames(arg1: unknown): Promise<string[]> {
return Promise.resolve(loader.getAliasNames(arg1 as DduAliasType));
},
async loadConfig(arg1: unknown): Promise<void> {
const path = ensureString(arg1);
const mod = await import(toFileUrl(path).href);
Expand Down
8 changes: 8 additions & 0 deletions doc/ddu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ ddu#custom#alias({type}, {alias-name}, {base-name})
\ foo: #{ mark: 'foo' },
\ })
<
*ddu#custom#get_alias()*
ddu#custom#get_alias({alias-type})
Get {alias-type} aliases.

*ddu#custom#get_current()*
ddu#custom#get_current({name})
Get current ddu options for {name}.
Expand All @@ -415,6 +419,10 @@ ddu#custom#get_global()
ddu#custom#get_local()
Get current buffer specific options.

*ddu#custom#get_source_names()*
ddu#custom#get_source_names()
Get loaded source names.

*ddu#custom#load_config()*
ddu#custom#load_config({path})
Load TypeScript configuration from {path} file.
Expand Down

0 comments on commit 013f4b2

Please sign in to comment.