Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 4 vtsls, tailwindserver config #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/user/extras/typescript-tools.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local M = {
enabled = false,
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
}
Expand Down
65 changes: 65 additions & 0 deletions lua/user/extras/vtsls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
return
end

local opts = {
mode = "n", -- NORMAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}

local M = {
event = "VeryLazy",
"yioneko/nvim-vtsls",
config = function()
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"help",
"man",
"lspinfo",
"spectre_panel",
"lir",
"DressingSelect",
"tsplayground",
"",
},
callback = function()
local mappings = {
c = {
name = "Tools➡(javascript)",
R = { "<cmd>VtsExec rename_file<Cr>", "[R]ename file" },
C = { "<cmd>VtsExec goto_project_config<cr>", "open [c]onfig" },
d = { "<cmd>VtsExec goto_source_definition<Cr>", "source [d]efenition" },
r = { "<cmd>VtsExec file_references<Cr>", "file [r]eferences" },
o = { "<cmd>VtsExec organize_imports<Cr>", "[o]rganize imports" },
s = { "<cmd>VtsExec sort_imports<Cr>", "[s]ort imports" },
U = { "<cmd>VtsExec remove_unused_imports<Cr>", "remove [U]nused imports" },
f = { "<cmd>VtsExec fix_all<Cr>", "[f]ix all" },
u = { "<cmd>VtsExec remove_unused<Cr>", "remove [u]nused" },
m = { "<cmd>VtsExec add_missing_imports<Cr>", "add [m]issing imports" },
a = { "<cmd>VtsExec source_actions<Cr>", "source [a]ctions" },
t = { "<cmd>VtsExec select_ts_version<Cr>", "select [t]s version" },
p = { "<cmd>VtsExec reload_projects<Cr>", "reload [p]rojects" },
},
}

which_key.register(mappings, opts)
end,
})

end
}

return M




4 changes: 4 additions & 0 deletions lua/user/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ function M.config()
require("neodev").setup {}
end

if server == "vtsls" then
require("lspconfig.configs").vtsls = require("vtsls").lspconfig
end

lspconfig[server].setup(opts)
end
end
Expand Down
29 changes: 29 additions & 0 deletions lua/user/lspsettings/tailwindcss.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
return {
settings = {
tailwindCSS = {
classAttributes = { "class", "className", "class:list", "classList", "ngClass", ".*Styles", ".*Classes" },
-- experimental = {
-- classRegex = {
-- "tw`([^`]*)",
-- "className\\s*:\\s*['\"`]([^'\"`]*)['\"`]",
-- "Classes \\=([^;]*);",
-- "'([^']*)'",
-- "Classes \\=([^;]*);",
-- '"([^"]*)"',
-- "Classes \\=([^;]*);",
-- "\\`([^\\`]*)\\`",
-- },
-- },
lint = {
cssConflict = "warning",
invalidApply = "error",
invalidConfigPath = "error",
invalidScreen = "error",
invalidTailwindDirective = "error",
invalidVariant = "error",
recommendedVariantOrder = "warning",
},
validate = true,
},
},
}
15 changes: 15 additions & 0 deletions lua/user/lspsettings/vtsls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Dont forget to uninstall tsserver
return {
settings = {
typescript = {
inlayHints = {
parameterNames = { enabled = "literals" },
parameterTypes = { enabled = true },
variableTypes = { enabled = true },
propertyDeclarationTypes = { enabled = true },
functionLikeReturnTypes = { enabled = true },
enumMemberValues = { enabled = true },
}
},
}
}