feat(lsp): Set up vtsls, vue_ls, install miscellaneous plugins

This commit is contained in:
Калистратов Максим
2026-06-02 14:49:22 +03:00
parent c00508b08d
commit 81e111c01e
12 changed files with 171 additions and 11 deletions

View File

@@ -3,10 +3,16 @@ local settings = {
---@type lspconfig.settings.lua_ls
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
hint = {
enable = true,
},
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = vim.list_extend({ vim.fn.expand("$VIMRUNTIME") }, vim.api.nvim_get_runtime_file("lua", true)),
},
workspace = { checkThirdParty = false, library = vim.list_extend({ vim.fn.expand('$VIMRUNTIME') }, vim.api.nvim_get_runtime_file('lua', true)) },
},
},
}

41
after/lsp/vtsls.lua Normal file
View File

@@ -0,0 +1,41 @@
---@type lspconfig.Config
return {
filetypes = {
"javascript",
"typescript",
"vue",
},
settings = {
---@type lspconfig.settings.vtsls
vtsls = {
tsserver = {
globalPlugins = {
{
name = "@vue/typescript-plugin",
location = require("mason-registry").get_package("vue-language-server"):get_install_path(),
languages = { "vue" },
configNamespace = "typescript",
},
},
},
suggest = {
autoImports = true,
},
updateImportsOnFileMove = { enabled = "always" },
inlayHints = {
enumMemberValues = {
enabled = true,
},
parameterNames = {
enabled = "literals",
},
parameterTypes = {
enabled = true,
},
propertyDeclarationTypes = {
enabled = true,
},
},
},
},
}

2
after/lsp/vue_ls.lua Normal file
View File

@@ -0,0 +1,2 @@
---@type lspconfig.Config
return {}

View File

@@ -0,0 +1,8 @@
local gitsigns = require("gitsigns")
gitsigns.setup({
current_line_blame = true,
current_line_blame_opts = {
delay = 100,
},
})

3
after/plugin/lualine.lua Normal file
View File

@@ -0,0 +1,3 @@
local lualine = require("lualine")
lualine.setup({})

12
after/plugin/null_ls.lua Normal file
View File

@@ -0,0 +1,12 @@
local null_ls = require("null-ls")
local options = {
sources = {
null_ls.builtins.diagnostics.phpcs.with({
command = "phpcs",
args = { "--report=json", "--stdin-path=$FILENAME", "-" },
}),
},
}
null_ls.setup(options)

28
after/plugin/tree.lua Normal file
View File

@@ -0,0 +1,28 @@
local tree = require("nvim-tree")
local utils = require("utils")
local api = require("nvim-tree.api")
local function on_attach(bufnr)
api.map.on_attach.default(bufnr)
end
---@type nvim_tree.config
local options = {
update_focused_file = {
enable = true,
exclude = function(args)
for _, dir in ipairs({ "node_modules", "vendor", ".git" }) do
if args.file:find(dir, 1, true) then
return true
end
end
return false
end,
},
on_attach = on_attach,
}
tree.setup(options)
utils.nmap("<leader>e", api.tree.toggle, "nvim-tree: toggle")

View File

@@ -1,3 +1,7 @@
-- Disable netrw
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.mapleader = " "
vim.g.localmapleader = " "

View File

@@ -2,11 +2,23 @@ local conform = require("conform")
---@type conform.setupOpts
local options = {
formatters = {
phpcbf = {
command = "phpcbf",
args = { "-" },
stdin = true,
exist_codes = { 0, 1 },
},
},
formatters_by_ft = {
lua = { "stylua" },
php = { "phpcbf" },
javascript = { "eslint_d" },
typescript = { "eslint_d" },
vue = { "eslint_d" },
},
format_on_save = {
timeout_ms = 500,
timeout_ms = 5000,
lsp_format = "fallback",
},
}

View File

@@ -5,16 +5,33 @@ require("mason-lspconfig").setup({
"lua_ls",
"stylua",
"intelephense",
"eslint",
"vtsls",
"vue_ls",
},
})
local telescope = require("telescope.builtin")
vim.api.nvim_create_autocmd("LspAttach", {
desc = "LSP Keymaps",
desc = "LspAttach",
callback = function(args)
local bufnr = args.buf
local options = { buffer = bufnr }
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
vim.diagnostic.config({
virtual_text = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "\u{F057}",
[vim.diagnostic.severity.WARN] = "\u{F071}",
[vim.diagnostic.severity.HINT] = "\u{F0EB}",
[vim.diagnostic.severity.INFO] = "\u{F05A}",
},
},
})
-- Navigation
utils.nmap("<leader>gt", telescope.lsp_type_definitions, "Go to Type Definition", options)
utils.nmap("<leader>gd", telescope.lsp_definitions, "Go to Definition", options)

View File

@@ -21,6 +21,9 @@ vim.pack.add({
-- Code formatting
{ src = "https://github.com/stevearc/conform.nvim" },
-- Code linting (non-LSP sources)
{ src = "https://github.com/nvimtools/none-ls.nvim" },
-- Appearance
{ src = "https://github.com/rose-pine/neovim", name = "rose-pine" },
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
@@ -32,6 +35,10 @@ vim.pack.add({
-- Miscellaneous
{ src = "https://github.com/windwp/nvim-autopairs" },
{ src = "https://github.com/folke/which-key.nvim" },
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
{ src = "https://github.com/nvim-tree/nvim-tree.lua" },
{ src = "https://github.com/tpope/vim-fugitive" },
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
-- WoW Addon API
{ src = "https://github.com/Tyrannican/warcraft-api.nvim" },

View File

@@ -12,6 +12,14 @@
"rev": "619363c30309d29ffa631e67c8183f2a72caa373",
"src": "https://github.com/stevearc/conform.nvim"
},
"gitsigns.nvim": {
"rev": "dd3f588bacbeb041be6facf1742e42097f62165d",
"src": "https://github.com/lewis6991/gitsigns.nvim"
},
"lualine.nvim": {
"rev": "221ce6b2d999187044529f49da6554a92f740a96",
"src": "https://github.com/nvim-lualine/lualine.nvim"
},
"mason-lspconfig.nvim": {
"rev": "0a695750d747db1e7e70bcf0267ef8951c95fc83",
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
@@ -20,6 +28,10 @@
"rev": "16ba83bfc8a25f52bb545134f5bee082b195c460",
"src": "https://github.com/mason-org/mason.nvim"
},
"none-ls.nvim": {
"rev": "f9d557ac7cd28a3a993b5ea49716498bd540b01f",
"src": "https://github.com/nvimtools/none-ls.nvim"
},
"nvim-autopairs": {
"rev": "7b9923abad60b903ece7c52940e1321d39eccc79",
"src": "https://github.com/windwp/nvim-autopairs"
@@ -28,6 +40,10 @@
"rev": "9573948c38bfabeec353ae7dd7d3ffec4c506a6b",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-tree.lua": {
"rev": "07f541fcaa4a5ae019598240362449ab7e9812b3",
"src": "https://github.com/nvim-tree/nvim-tree.lua"
},
"nvim-web-devicons": {
"rev": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c",
"src": "https://github.com/nvim-tree/nvim-web-devicons"
@@ -52,6 +68,10 @@
"rev": "bb66b815aff01e87b2e26be995116be8d2f91474",
"src": "https://github.com/romus204/tree-sitter-manager.nvim"
},
"vim-fugitive": {
"rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0",
"src": "https://github.com/tpope/vim-fugitive"
},
"warcraft-api.nvim": {
"rev": "c016bc54ed62bca5058cc3bd7553e429dd8caf37",
"src": "https://github.com/Tyrannican/warcraft-api.nvim"