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 46d35f3 commit 05144b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions autoload/ddu.vim
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ function ddu#load(type, names) abort
call ddu#denops#_notify('loadExtensions', [a:type, a:names])
endfunction

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

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

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

call ddu#denops#_load('ddu',
\ [s:root_dir, 'denops', 'ddu', 'app.ts']->join(s:sep))

Expand Down
2 changes: 1 addition & 1 deletion denops/ddu/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class Loader {
}
staticLines.push("};");
await Deno.writeTextFile(
await vars.g.get(denops, "ddu#_mods"),
await denops.call("ddu#denops#_mods") as string,
staticLines.join("\n"),
);
}
Expand Down

0 comments on commit 05144b5

Please sign in to comment.