|
@ -88,6 +88,7 @@ return { |
|
|
|
|
|
|
|
|
-- override default floating window border if not set |
|
|
-- override default floating window border if not set |
|
|
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview |
|
|
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview |
|
|
|
|
|
---@diagnostic disable-next-line: duplicate-set-field |
|
|
function vim.lsp.util.open_floating_preview(contents, syntax, options, ...) |
|
|
function vim.lsp.util.open_floating_preview(contents, syntax, options, ...) |
|
|
options = options or {} |
|
|
options = options or {} |
|
|
options.border = options.border or "rounded" |
|
|
options.border = options.border or "rounded" |
|
@ -112,6 +113,9 @@ return { |
|
|
-- Function to detect the operating system |
|
|
-- Function to detect the operating system |
|
|
local function get_os() |
|
|
local function get_os() |
|
|
local handle = io.popen('uname') |
|
|
local handle = io.popen('uname') |
|
|
|
|
|
if not handle then |
|
|
|
|
|
return error("Failed to detect operating system") |
|
|
|
|
|
end |
|
|
local result = handle:read("*a") |
|
|
local result = handle:read("*a") |
|
|
handle:close() |
|
|
handle:close() |
|
|
return result:lower():gsub("%s+", "") |
|
|
return result:lower():gsub("%s+", "") |
|
@ -165,7 +169,11 @@ return { |
|
|
lspconfig.volar.setup({ |
|
|
lspconfig.volar.setup({ |
|
|
-- capabilities = capabilities, |
|
|
-- capabilities = capabilities, |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|
filetypes = { "vue" }, |
|
|
|
|
|
|
|
|
filetypes = { |
|
|
|
|
|
"javascript", |
|
|
|
|
|
"typescript", |
|
|
|
|
|
"vue", |
|
|
|
|
|
}, |
|
|
on_new_config = function(new_config, new_root_dir) |
|
|
on_new_config = function(new_config, new_root_dir) |
|
|
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir) |
|
|
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir) |
|
|
end, |
|
|
end, |
|
@ -180,11 +188,12 @@ return { |
|
|
-- configure php server |
|
|
-- configure php server |
|
|
lspconfig["intelephense"].setup({ |
|
|
lspconfig["intelephense"].setup({ |
|
|
root_dir = function(pattern) |
|
|
root_dir = function(pattern) |
|
|
local cwd = vim.loop.cwd() |
|
|
|
|
|
local root = util.root_pattern('composer.json')(pattern) |
|
|
|
|
|
|
|
|
---@diagnostic disable-next-line: undefined-field |
|
|
|
|
|
local cwd = vim.loop.cwd() |
|
|
|
|
|
local root = util.root_pattern('composer.json')(pattern) |
|
|
|
|
|
|
|
|
-- prefer cwd if root is a descendant |
|
|
|
|
|
return util.path.is_descendant(cwd, root) and cwd or root |
|
|
|
|
|
|
|
|
-- prefer cwd if root is a descendant |
|
|
|
|
|
return util.path.is_descendant(cwd, root) and cwd or root |
|
|
end, |
|
|
end, |
|
|
capabilities = capabilities, |
|
|
capabilities = capabilities, |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|