feat(LSP): Add PHP parser, remap LSP keybindings

This commit is contained in:
Калистратов Максим
2026-06-01 12:52:53 +03:00
parent fd3267ca21
commit c00508b08d
8 changed files with 80 additions and 5 deletions

16
lua/highlighting.lua Normal file
View File

@@ -0,0 +1,16 @@
local manager = require("tree-sitter-manager")
---@type tree-sitter-manager.Config
local options = {
ensure_installed = {
"php",
"html",
"html_tags",
"ecma",
"typescript",
"vue",
"blade",
},
}
manager.setup(options)

View File

@@ -1,7 +1,42 @@
local utils = require("utils")
require("mason").setup({})
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"stylua",
"intelephense",
},
})
local telescope = require("telescope.builtin")
vim.api.nvim_create_autocmd("LspAttach", {
desc = "LSP Keymaps",
callback = function(args)
local bufnr = args.buf
local options = { buffer = bufnr }
-- 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)
utils.nmap("<leader>gD", vim.lsp.buf.declaration, "Go to Declaration", options)
utils.nmap("<leader>gi", telescope.lsp_implementations, "Go to Implementation", options)
utils.nmap("<leader>gr", telescope.lsp_references, "References", options)
utils.nmap("<leader>gs", telescope.lsp_document_symbols, "LSP Document Symbols", options)
utils.nmap("<leader>gS", telescope.lsp_dynamic_workspace_symbols, "LSP Workspace Symbols", options)
-- Info
utils.nmap("<leader>gh", vim.lsp.buf.hover, "Hover Docs", options)
utils.nmap("<leader>gH", vim.lsp.buf.signature_help, "Signature Help", options)
-- Refactor
utils.nmap("<leader>gn", vim.lsp.buf.rename, "Rename Symbol", options)
utils.nmap("<leader>ga", vim.lsp.buf.code_action, "Code Action", options)
utils.nmap("<leader>gf", vim.lsp.buf.format, "Format Buffer", options)
-- Diagnostics
utils.nmap("<leader>gl", vim.diagnostic.open_float, "Line Diagnostics", options)
utils.nmap("<leader>gk", vim.diagnostic.goto_prev, "Previous Diagnostic", options)
utils.nmap("<leader>gj", vim.diagnostic.goto_next, "Next Diagnostic", options)
utils.nmap("<leader>gq", vim.diagnostic.setloclist, "Diagnostics to Loclist", options)
end,
})

View File

@@ -11,6 +11,9 @@ vim.pack.add({
-- Automatically enable installed language servers
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
-- Automatically install TreeSitter parsers
{ src = "https://github.com/romus204/tree-sitter-manager.nvim" },
-- All-in-one completions engine
{ src = "https://github.com/saghen/blink.lib" },
{ src = "https://github.com/saghen/blink.cmp" },
@@ -28,6 +31,7 @@ vim.pack.add({
-- Miscellaneous
{ src = "https://github.com/windwp/nvim-autopairs" },
{ src = "https://github.com/folke/which-key.nvim" },
-- WoW Addon API
{ src = "https://github.com/Tyrannican/warcraft-api.nvim" },