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
|
||||
'';
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
servers = {
|
||||
hls = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.haskellPackages.haskell-language-server) "--debug"];
|
||||
cmd = [(getExe pkgs.haskellPackages.haskell-language-server) "--lsp"];
|
||||
filetypes = ["haskell" "lhaskell"];
|
||||
on_attach =
|
||||
mkLuaInline
|
||||
|
@ -51,28 +51,8 @@
|
|||
*/
|
||||
''
|
||||
function(bufnr, on_dir)
|
||||
local root_pattern = function(...)
|
||||
local patterns = M.tbl_flatten { ... }
|
||||
return function(startpath)
|
||||
startpath = M.strip_archive_subpath(startpath)
|
||||
for _, pattern in ipairs(patterns) do
|
||||
local match = M.search_ancestors(startpath, function(path)
|
||||
for _, p in ipairs(vim.fn.glob(table.concat({ escape_wildcards(path), pattern }, '/'), true, true)) do
|
||||
if vim.uv.fs_stat(p) then
|
||||
return path
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if match ~= nil then
|
||||
return match
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
on_dir(root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname))
|
||||
on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname))
|
||||
end
|
||||
'';
|
||||
settings = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue