chore(nvim): re-add Get_project_node_modules_path
This commit is contained in:
parent
97f4f9d636
commit
5443f5f067
|
@ -1,6 +1,6 @@
|
||||||
local prettier = function()
|
local prettier = function()
|
||||||
return {
|
return {
|
||||||
exe = vim.fn.getcwd() .. "/node_modules/.bin/prettier",
|
exe = Get_project_node_modules_path() .. "/.bin/prettier",
|
||||||
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
|
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
|
||||||
stdin = true,
|
stdin = true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
-- Return the node_modules path for this project. If the project root contains a
|
||||||
|
-- frontend/ directory, assume node_modules lives there.
|
||||||
|
function Get_project_node_modules_path()
|
||||||
|
local root_path = vim.fn.getcwd()
|
||||||
|
local frontend_path = root_path .. "/frontend"
|
||||||
|
local is_frontend = vim.fn.isdirectory(frontend_path) ~= 0
|
||||||
|
local base_path = root_path
|
||||||
|
if is_frontend then
|
||||||
|
base_path = frontend_path
|
||||||
|
end
|
||||||
|
return base_path .. "/node_modules"
|
||||||
|
end
|
||||||
|
|
||||||
-- Return the project's go module path from go.mod, or an empty string if the file cannot be read.
|
-- Return the project's go module path from go.mod, or an empty string if the file cannot be read.
|
||||||
function Get_project_go_module_path()
|
function Get_project_go_module_path()
|
||||||
local root_path = vim.fn.getcwd()
|
local root_path = vim.fn.getcwd()
|
||||||
|
|
Loading…
Reference in New Issue