- added tailwind tools
- updated rust lsp bindings with rustaceanvim features
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"rnvimr": { "branch": "main", "commit": "57f7a8edd629791557d1315463d9fb2e411a45f1" },
|
"rnvimr": { "branch": "main", "commit": "57f7a8edd629791557d1315463d9fb2e411a45f1" },
|
||||||
"rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" },
|
"rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" },
|
||||||
|
"tailwind-tools": { "branch": "master", "commit": "999d314444073095494f5a36b90fdba3c432a457" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||||
"undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
|
"undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
||||||
|
|||||||
+66
-10
@@ -14,15 +14,58 @@ local function nmap(...)
|
|||||||
map("n", ...)
|
map("n", ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lsp_config_defaults()
|
---@param params { no_formatting: boolean | nil, rust_lsp: boolean | nil } | nil
|
||||||
|
local function lsp_config_defaults(params)
|
||||||
|
local rust_lsp = params and params.rust_lsp
|
||||||
|
|
||||||
return {
|
return {
|
||||||
root_dir = require("lspconfig.util").root_pattern("pyproject.toml", "package.json", ".null-ls-root", ".git"),
|
root_dir = require("lspconfig.util").root_pattern("pyproject.toml", "package.json", ".null-ls-root", ".git"),
|
||||||
|
|
||||||
on_attach = function(_, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr })
|
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr })
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
|
||||||
|
if params and params.no_formatting then
|
||||||
|
-- diagnostics for other lsp get messed up when formatting is enabled
|
||||||
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
client.server_capabilities.documentRangeFormattingProvider = false
|
||||||
|
end
|
||||||
|
|
||||||
|
if rust_lsp then
|
||||||
|
nmap("gm", function()
|
||||||
|
vim.cmd.RustLsp("expandMacro")
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
nmap("ge", function()
|
||||||
|
vim.cmd.RustLsp("relatedDiagnostics")
|
||||||
|
end, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
nmap("K", function()
|
||||||
|
if rust_lsp then
|
||||||
|
vim.cmd.RustLsp({ "hover", "actions" })
|
||||||
|
else
|
||||||
|
vim.lsp.buf.hover()
|
||||||
|
end
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
nmap("[d", function()
|
||||||
|
if rust_lsp then
|
||||||
|
vim.cmd.RustLsp({ "renderDiagnostic", "cycle_prev" })
|
||||||
|
else
|
||||||
|
vim.diagnostic.jump({ count = -1, float = true, wrap = true })
|
||||||
|
end
|
||||||
|
end, opts)
|
||||||
|
|
||||||
|
nmap("]d", function()
|
||||||
|
if rust_lsp then
|
||||||
|
vim.cmd.RustLsp({ "renderDiagnostic", "cycle" })
|
||||||
|
else
|
||||||
|
vim.diagnostic.jump({ count = 1, float = true, wrap = true })
|
||||||
|
end
|
||||||
|
end, opts)
|
||||||
|
|
||||||
nmap("<C-k>", vim.lsp.buf.signature_help, opts)
|
nmap("<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
nmap("<space>D", vim.lsp.buf.type_definition, opts)
|
nmap("<space>D", vim.lsp.buf.type_definition, opts)
|
||||||
nmap("<space>ca", vim.lsp.buf.code_action, opts)
|
nmap("<space>ca", vim.lsp.buf.code_action, opts)
|
||||||
@@ -34,13 +77,6 @@ local function lsp_config_defaults()
|
|||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, opts)
|
end, opts)
|
||||||
nmap("<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
nmap("<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
nmap("K", vim.lsp.buf.hover, opts)
|
|
||||||
nmap("[d", function()
|
|
||||||
vim.diagnostic.goto_prev({ wrap = true })
|
|
||||||
end, opts)
|
|
||||||
nmap("]d", function()
|
|
||||||
vim.diagnostic.goto_next({ wrap = true })
|
|
||||||
end, opts)
|
|
||||||
nmap("gD", vim.lsp.buf.declaration, opts)
|
nmap("gD", vim.lsp.buf.declaration, opts)
|
||||||
nmap("gd", vim.lsp.buf.definition, opts)
|
nmap("gd", vim.lsp.buf.definition, opts)
|
||||||
nmap("gi", vim.lsp.buf.implementation, opts)
|
nmap("gi", vim.lsp.buf.implementation, opts)
|
||||||
@@ -517,7 +553,7 @@ end
|
|||||||
function M.rustaceanvim()
|
function M.rustaceanvim()
|
||||||
vim.g.rustaceanvim = {
|
vim.g.rustaceanvim = {
|
||||||
server = {
|
server = {
|
||||||
on_attach = lsp_config_defaults().on_attach,
|
on_attach = lsp_config_defaults({ rust_lsp = true }).on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
["rust-analyzer"] = {
|
["rust-analyzer"] = {
|
||||||
cargo = {
|
cargo = {
|
||||||
@@ -529,4 +565,24 @@ function M.rustaceanvim()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.tailwind_tools()
|
||||||
|
require("tailwind-tools").setup({
|
||||||
|
server = {
|
||||||
|
init_options = {
|
||||||
|
userLanguages = {
|
||||||
|
rust = "html",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
includeLanguages = {
|
||||||
|
rust = "html",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = {
|
||||||
|
"rust",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ config.nvim_autopairs()
|
|||||||
config.luasnip()
|
config.luasnip()
|
||||||
config.lsp_zero()
|
config.lsp_zero()
|
||||||
config.null_ls()
|
config.null_ls()
|
||||||
|
config.tailwind_tools()
|
||||||
|
|
||||||
-- REMOVING
|
-- REMOVING
|
||||||
--config.harpoon()
|
--config.harpoon()
|
||||||
|
|||||||
@@ -109,6 +109,17 @@ function M.install_plugins()
|
|||||||
version = "^5", -- Recommended
|
version = "^5", -- Recommended
|
||||||
lazy = false, -- This plugin is already lazy
|
lazy = false, -- This plugin is already lazy
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- TAILWIND
|
||||||
|
{
|
||||||
|
"luckasRanarison/tailwind-tools.nvim",
|
||||||
|
name = "tailwind-tools",
|
||||||
|
build = ":UpdateRemotePlugins",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
"neovim/nvim-lspconfig", -- optional
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user