Skip to content

Commit

Permalink
Fix mods
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed May 25, 2024
1 parent 1ba1179 commit 324defc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions autoload/ddc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ function ddc#update_items(name, items) abort
call ddc#denops#_notify('updateItems', [a:name, a:items])
endfunction

const s:root_dir = '<sfile>'->expand()->fnamemodify(':h:h')
function ddc#set_static_import_path() abort
" Clear current import path.
call writefile([
\ '// NOTE: It is dummy module.',
\ 'export const mods = {};',
\ ], s:root_dir .. '/denops/ddc/_mods.js')
\ ], ddc#denops#_mods())

call ddc#denops#_notify('setStaticImportPath', [])
endfunction
Expand Down
7 changes: 3 additions & 4 deletions autoload/ddc/denops.vim
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ endfunction

const s:root_dir = '<sfile>'->expand()->fnamemodify(':h:h:h')
const s:sep = has('win32') ? '\' : '/'
function ddc#denops#_mods() abort
return [s:root_dir, 'denops', 'ddc', '_mods.js']->join(s:sep)
endfunction
function s:register() abort
if !'g:ddc#_mods'->exists()
const g:ddc#_mods = [s:root_dir, 'denops', 'ddc', '_mods.js']->join(s:sep)
endif

call ddc#denops#_load(
\ 'ddc',
\ [s:root_dir, 'denops', 'ddc', 'app.ts']->join(s:sep))
Expand Down
2 changes: 1 addition & 1 deletion denops/ddc/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class Loader {
}
staticLines.push("};");
await Deno.writeTextFile(
await vars.g.get(denops, "ddc#_mods"),
await denops.call("ddc#denops#_mods") as string,
staticLines.join("\n"),
);
}
Expand Down

0 comments on commit 324defc

Please sign in to comment.