mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
use new util
This commit is contained in:
parent
a45cd326ec
commit
acf3cca302
2 changed files with 4 additions and 36 deletions
|
@ -35,20 +35,8 @@
|
|||
''
|
||||
function(_, config)
|
||||
-- TODO: Make this a shared util function
|
||||
local get_typescript_server_path = function(root_dir)
|
||||
local project_roots = vim.fs.find('node_modules', { path = root_dir, upward = true, limit = math.huge })
|
||||
for _, project_root in ipairs(project_roots) do
|
||||
local typescript_path = project_root .. '/typescript'
|
||||
local stat = vim.loop.fs_stat(typescript_path)
|
||||
if stat and stat.type == 'directory' then
|
||||
return typescript_path .. '/lib'
|
||||
end
|
||||
end
|
||||
return '''
|
||||
end
|
||||
|
||||
if config.init_options and config.init_options.typescript and not config.init_options.typescript.tsdk then
|
||||
config.init_options.typescript.tsdk = get_typescript_server_path(config.root_dir)
|
||||
config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir)
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue