|
@ -104,42 +104,59 @@ return { |
|
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) |
|
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
-- configure html server |
|
|
|
|
|
lspconfig["html"].setup({ |
|
|
|
|
|
|
|
|
lspconfig.html.setup({ |
|
|
capabilities = capabilities, |
|
|
capabilities = capabilities, |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
-- configure typescript server with plugin |
|
|
|
|
|
lspconfig["tsserver"].setup({ |
|
|
|
|
|
capabilities = capabilities, |
|
|
|
|
|
on_attach = on_attach, |
|
|
|
|
|
filetypes = { "typescript", "vue" }, |
|
|
|
|
|
init_options = { |
|
|
|
|
|
{ |
|
|
|
|
|
name = "@vue/typescript-plugin", |
|
|
|
|
|
location = "/usr/local/lib/node_modules/@vue/typescript-plugin", |
|
|
|
|
|
languages = {"javascript", "typescript", "vue"}, |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
lspconfig.tsserver.setup({ |
|
|
|
|
|
init_options = { |
|
|
|
|
|
plugins = { |
|
|
|
|
|
{ |
|
|
|
|
|
name = "@vue/typescript-plugin", |
|
|
|
|
|
location = "/usr/local/lib/node_modules/@vue/typescript-plugin", |
|
|
|
|
|
languages = { "javascript", "typescript", "vue" }, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
filetypes = { |
|
|
|
|
|
"javascript", |
|
|
|
|
|
"typescript", |
|
|
|
|
|
"vue", |
|
|
|
|
|
}, |
|
|
|
|
|
capabilities = capabilities, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
-- configure css server |
|
|
|
|
|
lspconfig["cssls"].setup({ |
|
|
|
|
|
capabilities = capabilities, |
|
|
|
|
|
|
|
|
local function get_typescript_server_path(root_dir) |
|
|
|
|
|
|
|
|
|
|
|
local global_ts = '/usr/local/lib/node_modules/typescript/lib' |
|
|
|
|
|
local found_ts = '' |
|
|
|
|
|
local function check_dir(path) |
|
|
|
|
|
found_ts = util.path.join(path, 'node_modules', 'typescript', 'lib') |
|
|
|
|
|
if util.path.exists(found_ts) then |
|
|
|
|
|
return path |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
if util.search_ancestors(root_dir, check_dir) then |
|
|
|
|
|
return found_ts |
|
|
|
|
|
else |
|
|
|
|
|
return global_ts |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
lspconfig.volar.setup({ |
|
|
|
|
|
-- capabilities = capabilities, |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|
|
|
|
filetypes = { "vue" }, |
|
|
|
|
|
on_new_config = function(new_config, new_root_dir) |
|
|
|
|
|
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir) |
|
|
|
|
|
end, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
-- configure emmet language server |
|
|
|
|
|
lspconfig["volar"].setup({ |
|
|
|
|
|
|
|
|
-- configure css server |
|
|
|
|
|
lspconfig["cssls"].setup({ |
|
|
capabilities = capabilities, |
|
|
capabilities = capabilities, |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|
filetypes = { "vue" }, |
|
|
|
|
|
init_options = { |
|
|
|
|
|
typescript = { |
|
|
|
|
|
tsdk = '/usr/local/lib/node_modules/typescript/lib' |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
-- configure php server |
|
|
-- configure php server |
|
|