aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2024-07-11 05:12:18 -0300
committerElvis Claros Castro <elvis@claros.ar>2024-07-11 05:12:18 -0300
commit1fd0af14d592d612c2aaab7717c04c8806ba3daa (patch)
tree46aa59ff785305fcc05209091aecf64ca89e05fb /lua/alpha
parentfb448577edebb1b093e6cc097c201151385986f8 (diff)
downloadnvim-conf-1fd0af14d592d612c2aaab7717c04c8806ba3daa.tar.gz
nvim-conf-1fd0af14d592d612c2aaab7717c04c8806ba3daa.zip
Feat: Todo actulizado
Diffstat (limited to 'lua/alpha')
-rw-r--r--lua/alpha/completition/init.lua94
-rw-r--r--lua/alpha/dap/configs/dart.lua2
-rw-r--r--lua/alpha/dap/configs/elixir.lua52
-rw-r--r--lua/alpha/dap/configs/javascript.lua103
-rw-r--r--lua/alpha/dap/init.lua4
-rw-r--r--lua/alpha/lsp/attach.lua2
-rw-r--r--lua/alpha/lsp/default.lua1
-rw-r--r--lua/alpha/lsp/servers/kotlin.lua1
-rw-r--r--lua/alpha/lsp/servers/vscode_smarty_langserver.lua25
9 files changed, 225 insertions, 59 deletions
diff --git a/lua/alpha/completition/init.lua b/lua/alpha/completition/init.lua
index 9933971..667e30b 100644
--- a/lua/alpha/completition/init.lua
+++ b/lua/alpha/completition/init.lua
@@ -7,6 +7,24 @@ local compare = require "cmp.config.compare"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })
cmp.setup {
+ window = {
+ completion = {
+ border = "rounded",
+ -- winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
+ -- winblend = vim.o.pumblend,
+ -- scrolloff = 0,
+ -- col_offset = 0,
+ -- side_padding = 1,
+ -- scrollbar = true,
+ },
+ documentation = {
+ -- max_height = math.floor(WIDE_HEIGHT * (WIDE_HEIGHT / vim.o.lines)),
+ -- max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))),
+ border = "rounded",
+ -- winhighlight = 'FloatBorder:NormalFloat',
+ -- winblend = vim.o.pumblend,
+ },
+ },
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
@@ -68,18 +86,70 @@ cmp.setup {
},
formatting = {
- format = lspkind.cmp_format {
- with_text = true,
- menu = {
- buffer = "[buf]",
- nvim_lsp = "[ ]",
- nvim_lua = "[api]",
- path = "[path]",
- luasnip = "[snip]",
- copilot = "[ﮧ ]",
- ["vim-dadbod-completion"] = "[DB]",
- },
- },
+ format = function (entry, vim_item)
+ lspkind.cmp_format {
+ with_text = true,
+ menu = {
+ buffer = "[buf]",
+ nvim_lsp = "[ ]",
+ nvim_lua = "[api]",
+ path = "[path]",
+ luasnip = "[snip]",
+ copilot = "[ﮧ ]",
+ ["vim-dadbod-completion"] = "[DB]",
+ },
+ }
+ local KIND_ICONS = {
+ Tailwind = '󰹞󰹞󰹞󰹞󰹞󰹞󰹞󰹞',
+ Color = ' ',
+ -- Class = 7,
+ -- Constant = '󰚞',
+ -- Constructor = 4,
+ -- Enum = 13,
+ -- EnumMember = 20,
+ -- Event = 23,
+ -- Field = 5,
+ -- File = 17,
+ -- Folder = 19,
+ -- Function = 3,
+ -- Interface = 8,
+ -- Keyword = 14,
+ -- Method = 2,
+ -- Module = 9,
+ -- Operator = 24,
+ -- Property = 10,
+ -- Reference = 18,
+ Snippet = " ",
+ -- Struct = 22,
+ -- Text = "",
+ -- TypeParameter = 25,
+ -- Unit = 11,
+ -- Value = 12,
+ -- Variable = 6
+ }
+ if vim_item.kind == 'Color' and entry.completion_item.documentation then
+ local _, _, r, g, b =
+ ---@diagnostic disable-next-line: param-type-mismatch
+ string.find(entry.completion_item.documentation, '^rgb%((%d+), (%d+), (%d+)')
+
+ if r and g and b then
+ local color = string.format('%02x', r) .. string.format('%02x', g) .. string.format('%02x', b)
+ local group = 'Tw_' .. color
+
+ if vim.api.nvim_call_function('hlID', { group }) < 1 then
+ vim.api.nvim_command('highlight' .. ' ' .. group .. ' ' .. 'guifg=#' .. color)
+ end
+
+ vim_item.kind = KIND_ICONS.Tailwind
+ vim_item.kind_hl_group = group
+
+ return vim_item
+ end
+ end
+
+ vim_item.kind = KIND_ICONS[vim_item.kind] or vim_item.kind
+ return vim_item
+ end
},
sorting = {
diff --git a/lua/alpha/dap/configs/dart.lua b/lua/alpha/dap/configs/dart.lua
index cdb7a47..a23c118 100644
--- a/lua/alpha/dap/configs/dart.lua
+++ b/lua/alpha/dap/configs/dart.lua
@@ -27,6 +27,6 @@ dap.configurations.dart = {
-- The nvim-dap plugin populates this variable with the editor's current working directory
cwd = "${workspaceFolder}",
-- This gets forwarded to the Flutter CLI tool, substitute `linux` for whatever device you wish to launch
- toolArgs = {"-d", "192.168.0.15:5555"}
+ toolArgs = {"-d", "192.168.0.33:5555"}
}
}
diff --git a/lua/alpha/dap/configs/elixir.lua b/lua/alpha/dap/configs/elixir.lua
new file mode 100644
index 0000000..bf732ce
--- /dev/null
+++ b/lua/alpha/dap/configs/elixir.lua
@@ -0,0 +1,52 @@
+local dap = require('dap')
+
+dap.adapters.mix_task = {
+ type = 'executable',
+ command = 'elixir-ls-debugger', -- El comando 'elixir-ls' está en $PATH
+ args = {}
+}
+
+dap.configurations.elixir = {
+ {
+ type = "mix_task",
+ name = "mix (Default task)",
+ request = "launch",
+ projectDir = "${workspaceRoot}"
+ },
+ {
+ type = "mix_task",
+ name = "mix test",
+ request = "launch",
+ task = 'test',
+ env = {
+ MIX_ENV = "test",
+ MIX_TARGET = "host",
+ HEX_UNSAFE_HTTPS = 1
+ },
+ taskArgs = {"--trace"},
+ startApps = true, -- for Phoenix projects
+ projectDir = "${workspaceFolder}",
+ requireFiles = {
+ "test/**/test_helper.exs",
+ "test/**/*_test.exs"
+ }
+ },
+ {
+ type = "mix_task",
+ name = "phx server",
+ request = "launch",
+ stackTraceMode = "all",
+ task = 'phx.server',
+ debugAutoInterpretAllModules = true,
+ noDebug = false,
+ exitAfterTaskReturns = false,
+ env = {
+ MIX_ENV = "dev",
+ MIX_TARGET = "host",
+ HEX_UNSAFE_HTTPS = 1
+ },
+ startApps = false, -- for Phoenix projects
+ taskArgs = {"--no-halt", "--open"},
+ projectDir = "${workspaceFolder}",
+ },
+}
diff --git a/lua/alpha/dap/configs/javascript.lua b/lua/alpha/dap/configs/javascript.lua
index b910f30..03173ba 100644
--- a/lua/alpha/dap/configs/javascript.lua
+++ b/lua/alpha/dap/configs/javascript.lua
@@ -1,45 +1,62 @@
-require("dap-vscode-js").setup {
- debugger_cmd = { "js-debug-adapter" },
- adapters = { "pwa-node", "pwa-chrome", "node-terminal" },
+local dap = require('dap')
+dap.adapters.firefox = {
+ type = 'executable',
+ command = 'firefox-debug-adapter',
}
-for _, language in ipairs { "typescript", "javascript" } do
- require("dap").configurations[language] = {
- {
- type = "pwa-node",
- request = "launch",
- name = "Launch file",
- program = "${file}",
- cwd = "${workspaceFolder}",
- },
- {
- type = "pwa-node",
- request = "attach",
- name = "Attach",
- processId = require("dap.utils").pick_process,
- cwd = "${workspaceFolder}",
- },
- }
-end
-
-for _, language in ipairs { "typescriptreact", "javascriptreact" } do
- require("dap").configurations[language] = {
- {
- type = "pwa-chrome",
- name = "Attach - Remote Debugging",
- request = "attach",
- program = "${file}",
- cwd = vim.fn.getcwd(),
- sourceMaps = true,
- protocol = "inspector",
- port = 9222,
- webRoot = "${workspaceFolder}",
- },
- {
- type = "pwa-chrome",
- name = "Launch Chrome",
- request = "launch",
- url = "http://localhost:3000",
- },
- }
-end
+dap.configurations.typescript = {
+ {
+ name = 'Debug with Firefox',
+ type = 'firefox',
+ request = 'launch',
+ reAttach = true,
+ url = 'http://localhost:3010',
+ webRoot = '${workspaceFolder}',
+ firefoxExecutable = '/home/elvis/.local/bin/firefox'
+ },
+}
+-- require("dap-vscode-js").setup {
+-- debugger_cmd = { "js-debug-adapter" },
+-- adapters = { "pwa-node", "pwa-chrome", "node-terminal" },
+-- }
+--
+-- for _, language in ipairs { "typescript", "javascript" } do
+-- require("dap").configurations[language] = {
+-- {
+-- type = "pwa-node",
+-- request = "launch",
+-- name = "Launch file",
+-- program = "${file}",
+-- cwd = "${workspaceFolder}",
+-- },
+-- {
+-- type = "pwa-node",
+-- request = "attach",
+-- name = "Attach",
+-- processId = require("dap.utils").pick_process,
+-- cwd = "${workspaceFolder}",
+-- },
+-- }
+-- end
+--
+-- for _, language in ipairs { "typescriptreact", "javascriptreact" } do
+-- require("dap").configurations[language] = {
+-- {
+-- type = "pwa-chrome",
+-- name = "Attach - Remote Debugging",
+-- request = "attach",
+-- program = "${file}",
+-- cwd = vim.fn.getcwd(),
+-- sourceMaps = true,
+-- protocol = "inspector",
+-- port = 9222,
+-- webRoot = "${workspaceFolder}",
+-- },
+-- {
+-- type = "pwa-chrome",
+-- name = "Launch Chrome",
+-- request = "launch",
+-- url = "http://localhost:3000",
+-- },
+-- }
+-- end
diff --git a/lua/alpha/dap/init.lua b/lua/alpha/dap/init.lua
index 44b3e50..12ea352 100644
--- a/lua/alpha/dap/init.lua
+++ b/lua/alpha/dap/init.lua
@@ -1,5 +1,7 @@
local dap, dapui, hydra = require "dap", require "dapui", require "hydra"
+dap.set_log_level('TRACE')
+
-- Setup Virtual Text
require("nvim-dap-virtual-text").setup {}
@@ -15,7 +17,7 @@ vim.fn.sign_define("DapBreakpointCondition", { text = "❓", texthl = "", linehl
vim.fn.sign_define("DapLogPoint", { text = "💬", texthl = "", linehl = "", numhl = "" })
-- UI structure
-dapui.setup {
+dapui.setup {
icons = { expanded = "▾", collapsed = "▸" },
layouts = {
{
diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua
index e71cb75..7c7413c 100644
--- a/lua/alpha/lsp/attach.lua
+++ b/lua/alpha/lsp/attach.lua
@@ -24,6 +24,6 @@ return function(client, bufnr)
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
if client.server_capabilities.inlayHintProvider then
- vim.lsp.inlay_hint(bufnr, true)
+ vim.lsp.inlay_hint.enable(bufnr)
end
end
diff --git a/lua/alpha/lsp/default.lua b/lua/alpha/lsp/default.lua
index e4bf24e..61e1b28 100644
--- a/lua/alpha/lsp/default.lua
+++ b/lua/alpha/lsp/default.lua
@@ -19,6 +19,7 @@ return {
texlab = { enable = true, filetypes = {"tex", "bib"} },
pyright = { enable = true, filetypes = {"python"} },
kotlin_language_server = { enable = true, filetypes = {"kotlin"}, root_dir = require("lspconfig.util").root_pattern("build.gradle.kts", "pom.xml", ".git") },
+ smarty_ls = { enable = true, filetypes = {"smarty"}, root_dir = require("lspconfig.util").root_pattern("composer.json", ".git") },
},
default_options = function (options)
return vim.tbl_deep_extend("force", {
diff --git a/lua/alpha/lsp/servers/kotlin.lua b/lua/alpha/lsp/servers/kotlin.lua
deleted file mode 100644
index 39cdd0d..0000000
--- a/lua/alpha/lsp/servers/kotlin.lua
+++ /dev/null
@@ -1 +0,0 @@
--
diff --git a/lua/alpha/lsp/servers/vscode_smarty_langserver.lua b/lua/alpha/lsp/servers/vscode_smarty_langserver.lua
new file mode 100644
index 0000000..e404698
--- /dev/null
+++ b/lua/alpha/lsp/servers/vscode_smarty_langserver.lua
@@ -0,0 +1,25 @@
+local lsp_attach = require "alpha.lsp.attach"
+local lsp_flags = require "alpha.lsp.flags"
+
+return function(ops)
+ return vim.tbl_extend("force", {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ settings = {
+ css = {
+ validate = true
+ },
+ smarty = {
+ pluginDirs = {}
+ },
+ ["smarty_ls"] = {
+ checkOnSave = {
+ overrideCommand = {
+ "smarty-language-server",
+ "--stdio",
+ },
+ },
+ },
+ },
+ }, ops)
+end