From 324defc054529220cf577d1122e09f7c9ae6ea9d Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 25 May 2024 10:35:02 +0900 Subject: [PATCH] Fix mods --- autoload/ddc.vim | 3 +-- autoload/ddc/denops.vim | 7 +++---- denops/ddc/loader.ts | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/autoload/ddc.vim b/autoload/ddc.vim index 72defff..44cb9be 100644 --- a/autoload/ddc.vim +++ b/autoload/ddc.vim @@ -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 = ''->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 diff --git a/autoload/ddc/denops.vim b/autoload/ddc/denops.vim index 420d2ae..0caec9a 100644 --- a/autoload/ddc/denops.vim +++ b/autoload/ddc/denops.vim @@ -65,11 +65,10 @@ endfunction const s:root_dir = ''->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)) diff --git a/denops/ddc/loader.ts b/denops/ddc/loader.ts index 065ce7a..b54bb0d 100644 --- a/denops/ddc/loader.ts +++ b/denops/ddc/loader.ts @@ -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"), ); }