From 2c758c8ecbbbbcf8b4f6c805eb35e2de38722283 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Wed, 7 Aug 2024 16:42:06 +0200 Subject: [PATCH] fixed plugins --- lua/plugins.lua | 35 ++++++++++++++++++++++------ lua/plugins/formatter.lua | 20 ++++++++++++++++ lua/plugins/lsp.lua | 48 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 95 insertions(+), 8 deletions(-) diff --git a/lua/plugins.lua b/lua/plugins.lua index 23824f7..3ef7a66 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -107,6 +107,28 @@ require("lazy").setup( "jay-babu/mason-null-ls.nvim" } }, + { + "luckasRanarison/tailwind-tools.nvim", + dependencies = {"nvim-treesitter/nvim-treesitter"}, + opts = { + document_color = { + enabled = true, -- can be toggled by commands + kind = "inline", -- "inline" | "foreground" | "background" + inline_symbol = "󰝤 ", -- only used in inline mode + debounce = 200 -- in milliseconds, only applied in insert mode + }, + conceal = { + enabled = false, -- can be toggled by commands + min_length = nil, -- only conceal classes exceeding the provided length + symbol = "󱏿", -- only a single character is allowed + highlight = { + -- extmark highlight options, see :h 'highlight' + fg = "#38BDF8" + } + }, + custom_filetypes = {} -- see the extension section to learn how it works + } -- your configuration + }, { "nvim-telescope/telescope.nvim", config = function() @@ -131,7 +153,6 @@ require("lazy").setup( mappings = { i = { [""] = "close", - ["n"] = {require("telescope.actions").move_selection_next, type = "action"}, ["1"] = {selectX(1), type = "action"}, ["2"] = {selectX(2), type = "action"}, ["3"] = {selectX(3), type = "action"}, @@ -214,12 +235,12 @@ require("lazy").setup( -- require("plugins/copilot") -- end -- }, - { - "supermaven-inc/supermaven-nvim", - config = function() - require("supermaven-nvim").setup({}) - end - }, + -- { + -- "supermaven-inc/supermaven-nvim", + -- config = function() + -- require("supermaven-nvim").setup({}) + -- end + -- }, { "ggandor/lightspeed.nvim", dependencies = {"tpope/vim-repeat"} diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua index d00b550..6d7c0f8 100644 --- a/lua/plugins/formatter.lua +++ b/lua/plugins/formatter.lua @@ -95,3 +95,23 @@ vim.api.nvim_create_autocmd( group = formatGrp } ) + +local function organize_imports() + local params = { + command = "typescript.organizeImports", + arguments = {vim.api.nvim_buf_get_name(0)}, + title = "" + } + vim.lsp.buf.execute_command(params) +end +local organizeImportsGrp = vim.api.nvim_create_augroup("OrgImports", {clear = true}) +vim.api.nvim_create_autocmd( + "BufWritePre", + { + pattern = "*.ts,*.tsx", + callback = function(ev) + organize_imports() + end, + group = formatGrp + } +) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 938b2de..2b0ec9c 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -33,7 +33,8 @@ local extra_servers = { "eslint", "jsonls", "omnisharp", - "rust_analyzer" + "rust_analyzer", + "tailwindcss" } -- Ensure that required tools are installed @@ -172,6 +173,51 @@ for _, lsp in ipairs(common_servers) do } end +local path = vim.uv.cwd() +local config_path = path .. "/.vscode/settings.json" +local tailwindcss_settings = {} +if vim.uv.fs_stat(config_path) then + local file = vim.fn.readfile(config_path) + local vscode_settings = vim.fn.json_decode(file) + tailwindcss_settings = + vim.tbl_deep_extend( + "force", + tailwindcss_settings, + { + tailwindCSS = { + rootFontSize = vscode_settings["tailwindCSS.rootFontSize"] + } + } + ) +end +nvim_lsp.tailwindcss.setup { + on_attach = on_attach, + flags = { + debounce_text_changes = 150 + }, + capabilities = capabilities, + -- on_init = function(client) + -- local path = client.workspace_folders and client.workspace_folders[1] and client.workspace_folders[1].name + -- local config_path = path .. "/.vscode/settings.json" + -- if vim.uv.fs_stat(config_path) then + -- local file = vim.fn.readfile(config_path) + -- local vscode_settings = vim.fn.json_decode(file) + -- client.config.settings = + -- vim.tbl_deep_extend( + -- "force", + -- client.config.settings, + -- { + -- tailwindCSS = { + -- rootFontSize = vscode_settings["tailwindCSS.rootFontSize"] + -- } + -- } + -- ) + -- client.notify(vim.lsp.protocol.Methods.workspace_didChangeConfiguration, {settings = client.config.settings}) + -- end + -- end, + settings = tailwindcss_settings +} + nvim_lsp.omnisharp.setup { cmd = {"OmniSharp"}, enable_editorconfig_support = true,