fix: cpp conflix error

This commit is contained in:
asep.komarudin 2024-06-22 17:19:58 +07:00
parent ea7e0730c2
commit bdd33afd27
2 changed files with 77 additions and 73 deletions

View file

@ -47,7 +47,7 @@
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" }, "nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" },
"nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" },
"nvim-treesitter": { "branch": "master", "commit": "b967bbc27b564001c3d3b8ea93444cf6d0b21d23" }, "nvim-treesitter": { "branch": "master", "commit": "122b4d3db1616c1f1305b847c5ed2217c4c329f1" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
"nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" }, "nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },

View file

@ -1,59 +1,59 @@
local servers = { local servers = {
"lua_ls", "lua_ls",
} }
local function idxOf(array, value) local function idxOf(array, value)
for i, v in ipairs(array) do for i, v in ipairs(array) do
if v == value then if v == value then
return i return i
end end
end end
return nil return nil
end end
local mason_install = pcode.mason_ensure_installed or {} local mason_install = pcode.mason_ensure_installed or {}
for _, client in pairs(mason_install) do for _, client in pairs(mason_install) do
table.insert(servers, client) table.insert(servers, client)
end end
local unregis_lsp = pcode.unregister_lsp or {} local unregis_lsp = pcode.unregister_lsp or {}
local icons = vim.g.pcode_icons.ui local icons = vim.g.pcode_icons.ui
local settings = { local settings = {
ui = { ui = {
-- border = "none", -- border = "none",
border = icons.Border, border = icons.Border,
icons = { icons = {
package_pending = icons.DotCircle, package_pending = icons.DotCircle,
package_installed = icons.CheckCircle, package_installed = icons.CheckCircle,
package_uninstalled = icons.BlankCircle, package_uninstalled = icons.BlankCircle,
}, },
keymaps = { keymaps = {
-- Keymap to expand a server in the UI -- Keymap to expand a server in the UI
toggle_server_expand = "<CR>", toggle_server_expand = "<CR>",
-- Keymap to install the server under the current cursor position -- Keymap to install the server under the current cursor position
install_server = "i", install_server = "i",
-- Keymap to reinstall/update the server under the current cursor position -- Keymap to reinstall/update the server under the current cursor position
update_server = "u", update_server = "u",
-- Keymap to check for new version for the server under the current cursor position -- Keymap to check for new version for the server under the current cursor position
check_server_version = "c", check_server_version = "c",
-- Keymap to update all installed servers -- Keymap to update all installed servers
update_all_servers = "U", update_all_servers = "U",
-- Keymap to check which installed servers are outdated -- Keymap to check which installed servers are outdated
check_outdated_servers = "C", check_outdated_servers = "C",
-- Keymap to uninstall a server -- Keymap to uninstall a server
uninstall_server = "X", uninstall_server = "X",
}, },
}, },
log_level = vim.log.levels.INFO, log_level = vim.log.levels.INFO,
max_concurrent_installers = 4, max_concurrent_installers = 4,
} }
require("mason").setup(settings) require("mason").setup(settings)
-- * buka remark ini jika akan menggunakan list serverrs diatas dan remark config dibawah -- * buka remark ini jika akan menggunakan list serverrs diatas dan remark config dibawah
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = servers, ensure_installed = servers,
automatic_installation = true, automatic_installation = true,
}) })
-- --
-- * buka remark ini jika ingin menjalankan dengan cara install dan remark config diatas (pilih satu) -- * buka remark ini jika ingin menjalankan dengan cara install dan remark config diatas (pilih satu)
@ -61,46 +61,50 @@ require("mason-lspconfig").setup({
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status_ok then if not lspconfig_status_ok then
return return
end end
local opts = {} local opts = {}
require("mason-lspconfig").setup_handlers({ require("mason-lspconfig").setup_handlers({
function(server_name) -- default handler (optional) function(server_name) -- default handler (optional)
local is_skip = false local capabilities = require("user.lsp.handlers").capabilities
local my_index = idxOf(unregis_lsp, server_name) if server_name == "clangd" then
if my_index ~= nil then capabilities.offsetEncoding = { "utf-16" }
is_skip = true end
end local is_skip = false
if not is_skip then local my_index = idxOf(unregis_lsp, server_name)
opts = { if my_index ~= nil then
on_attach = require("user.lsp.handlers").on_attach, is_skip = true
capabilities = require("user.lsp.handlers").capabilities, end
} if not is_skip then
opts = {
on_attach = require("user.lsp.handlers").on_attach,
capabilities = capabilities,
}
server_name = vim.split(server_name, "@")[1] server_name = vim.split(server_name, "@")[1]
local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server_name) local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server_name)
if require_ok then if require_ok then
opts = vim.tbl_deep_extend("force", conf_opts, opts) opts = vim.tbl_deep_extend("force", conf_opts, opts)
end end
lspconfig[server_name].setup(opts) lspconfig[server_name].setup(opts)
end end
end, end,
-- Next, you can provide targeted overrides for specific servers. -- Next, you can provide targeted overrides for specific servers.
-- ["rust_analyzer"] = function() -- ["rust_analyzer"] = function()
-- require("rust-tools").setup({}) -- require("rust-tools").setup({})
-- end, -- end,
-- ["lua_ls"] = function() -- ["lua_ls"] = function()
-- lspconfig.sumneko_lua.setup({ -- lspconfig.sumneko_lua.setup({
-- settings = { -- settings = {
-- Lua = { -- Lua = {
-- diagnostics = { -- diagnostics = {
-- globals = { "vim" }, -- globals = { "vim" },
-- }, -- },
-- }, -- },
-- }, -- },
-- }) -- })
-- end, -- end,
}) })