|
@ -109,12 +109,30 @@ return { |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
-- Function to detect the operating system |
|
|
|
|
|
local function get_os() |
|
|
|
|
|
local handle = io.popen('uname') |
|
|
|
|
|
local result = handle:read("*a") |
|
|
|
|
|
handle:close() |
|
|
|
|
|
return result:lower():gsub("%s+", "") |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Set the base path based on the operating system |
|
|
|
|
|
local os = get_os() |
|
|
|
|
|
local base_path = "" |
|
|
|
|
|
|
|
|
|
|
|
if os == "darwin" then |
|
|
|
|
|
base_path = "/opt/homebrew/lib/node_modules" |
|
|
|
|
|
elseif os == "linux" then |
|
|
|
|
|
base_path = "/usr/lib/node_modules" |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
lspconfig.tsserver.setup({ |
|
|
lspconfig.tsserver.setup({ |
|
|
init_options = { |
|
|
init_options = { |
|
|
plugins = { |
|
|
plugins = { |
|
|
{ |
|
|
{ |
|
|
name = "@vue/typescript-plugin", |
|
|
name = "@vue/typescript-plugin", |
|
|
location = "/usr/local/lib/node_modules/@vue/typescript-plugin", |
|
|
|
|
|
|
|
|
location = base_path .. "/@vue/typescript-plugin", |
|
|
languages = { "javascript", "typescript", "vue" }, |
|
|
languages = { "javascript", "typescript", "vue" }, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -129,7 +147,7 @@ return { |
|
|
|
|
|
|
|
|
local function get_typescript_server_path(root_dir) |
|
|
local function get_typescript_server_path(root_dir) |
|
|
|
|
|
|
|
|
local global_ts = '/usr/local/lib/node_modules/typescript/lib' |
|
|
|
|
|
|
|
|
local global_ts = base_path .. '/typescript/lib' |
|
|
local found_ts = '' |
|
|
local found_ts = '' |
|
|
local function check_dir(path) |
|
|
local function check_dir(path) |
|
|
found_ts = util.path.join(path, 'node_modules', 'typescript', 'lib') |
|
|
found_ts = util.path.join(path, 'node_modules', 'typescript', 'lib') |
|
|