diff --git a/lazy-lock.json b/lazy-lock.json index adb9814..a3cbfa3 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,7 +27,7 @@ "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, "noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" }, "none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" }, - "none-ls.nvim": { "branch": "main", "commit": "cc0a3c45047e3daf85d07c1571d65476cfce6480" }, + "none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" }, "nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, @@ -38,9 +38,9 @@ "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" }, "nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" }, - "nvim-treesitter": { "branch": "master", "commit": "7b04b398f868563cac37ae90baffd7c3dca513fe" }, + "nvim-treesitter": { "branch": "master", "commit": "b967bbc27b564001c3d3b8ea93444cf6d0b21d23" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, + "nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, "playground": { "branch": "master", "commit": "bcfab84f98a33f2ad34dda6c842046dca70aabf6" }, @@ -48,7 +48,7 @@ "rainbow-delimiters.nvim": { "branch": "master", "commit": "12b1a1e095d968887a17ef791c2edb78d7595d46" }, "rest.nvim": { "branch": "main", "commit": "91badd46c60df6bd9800c809056af2d80d33da4c" }, "smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" }, - "telescope.nvim": { "branch": "master", "commit": "c392f1b78eaaf870ca584bd698e78076ed301b26" }, + "telescope.nvim": { "branch": "master", "commit": "f2bfde705ac752c52544d5cfa8b0aee0a766c1ed" }, "tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" }, "toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, diff --git a/lua/custom/default.lua b/lua/custom/default.lua index ecaa9e3..ab55979 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -60,7 +60,6 @@ pcode.lspghost_text = false -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md pcode.mason_ensure_installed = { -- sebelumnya register_lsp -- "yamlls", - -- "intelephense", -- tambahkan di bawah sini setelah melakukan :masoninstall } pcode.unregister_lsp = { @@ -163,3 +162,5 @@ pcode.jest_command = "npm test -- " pcode.jest_config = "jest.config.mjs" -- https://github.com/fredrikaverpil/neotest-golang pcode.gotest = false + +pcode.acive_rust_config = false diff --git a/lua/plugins/rust.lua b/lua/plugins/rust.lua new file mode 100644 index 0000000..0cad275 --- /dev/null +++ b/lua/plugins/rust.lua @@ -0,0 +1,126 @@ +local M = {} +if pcode.acive_rust_config then + M = { + { + "rust-lang/rust.vim", + ft = "rust", + init = function() + vim.g.rustfmt_autosave = 1 + end, + }, + { + "saecki/crates.nvim", + tag = "stable", + ft = { "toml" }, + config = function() + require("crates").setup() + end, + }, + { + "mrcjkb/rustaceanvim", + version = "^4", + ft = { "rust" }, + dependencies = "neovim/nvim-lspconfig", + config = function() + local on_attach = require("user.lsp.handlers").on_attach + local capabilities = require("user.lsp.handlers").capabilities + + vim.g.rustaceanvim = { + server = { + on_attach = on_attach, + capabilities = capabilities, + }, + } + end, + keys = { + { "rt", "lua vim.cmd.RustLsp('run')", desc = "Run Rust" }, + }, + }, + { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("neotest").setup({ + adapters = { + require("rustaceanvim.neotest"), + }, + }) + end, + -- stylua: ignore + keys = { + { "T","",desc="  Test"}, + { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, + { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, + { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, + { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, + { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, + { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, + { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, + { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, + }, + }, + { + "mfussenegger/nvim-dap", + event = "BufReadPre", + dependencies = { + "rcarriga/nvim-dap-ui", + "theHamsta/nvim-dap-virtual-text", + "nvim-neotest/nvim-nio", + "williamboman/mason.nvim", + "jay-babu/mason-nvim-dap.nvim", + }, + config = function() + require("nvim-dap-virtual-text").setup({ + virt_text_pos = "eol", + commented = true, + }) + + require("mason-nvim-dap").setup({ + automatic_installation = true, + automatic_setup = true, + handlers = {}, + ensure_installed = { "codelldb" }, + }) + local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/") + local debugrs_path = mason_path .. "packages/codelldb/extension/adapter/codelldb" + require("user.dapui") + local dap = require("dap") + dap.adapters.codelldb = { + type = "server", + port = "${port}", + executable = { + -- CHANGE THIS to your path! + command = debugrs_path, + args = { "--port", "${port}" }, + + -- On windows you may have to uncomment this: + detached = vim.fn.has("win32") and false or true, + }, + } + end, + keys = { + { "d", "", desc = "  Debug" }, + { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require'dap'.step_back()", desc = "Step Back" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, + { "dg", "lua require'dap'.session()", desc = "Get Session" }, + { "di", "lua require'dap'.step_into()", desc = "Step Into" }, + { "do", "lua require'dap'.step_over()", desc = "Step Over" }, + { "du", "lua require'dap'.step_out()", desc = "Step Out" }, + { "dp", "lua require'dap'.pause()", desc = "Pause" }, + { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require'dap'.continue()", desc = "Start" }, + { "dq", "lua require'dap'.close()", desc = "Quit" }, + { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, + }, + }, + } +end +return M diff --git a/lua/plugins/themes/_globalvar.lua b/lua/plugins/themes/_globalvar.lua index ceee4d5..925391c 100644 --- a/lua/plugins/themes/_globalvar.lua +++ b/lua/plugins/themes/_globalvar.lua @@ -28,4 +28,8 @@ _G.all_trim = function(s) return s:match("^%s*(.-)%s*$") end +if pcode.acive_rust_config then + table.insert(pcode.mason_ensure_installed, "rust_analyzer") + table.insert(pcode.unregister_lsp, "rust_analyzer") +end return {}