Skip to content
Merged
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
11 changes: 10 additions & 1 deletion config/nvim-lazyvim/lua/plugins/00-lazyvim-imports.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ return {
-- Note: lazyvim.plugins is imported in lua/config/lazy.lua
-- We only need to import extras here, in the correct order

-- Import LazyVim extras
-- Import LazyVim language extras
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.python" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lang.terraform" },

-- Import LazyVim tool extras
{ import = "lazyvim.plugins.extras.formatting.prettier" },
{ import = "lazyvim.plugins.extras.linting.eslint" },

-- Configure LazyVim colorscheme
{
Expand Down
66 changes: 64 additions & 2 deletions config/nvim-lazyvim/lua/plugins/cmp.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,74 @@
return {
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
dependencies = {
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"f3fora/cmp-spell",
"ray-x/cmp-treesitter",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local cmp = require("cmp")

-- Ensure opts.sources exists before inserting
opts.sources = opts.sources or {}
table.insert(opts.sources, { name = "emoji" })

-- Add additional completion sources
vim.list_extend(opts.sources, {
{ name = "emoji" },
{ name = "path" },
{ name = "treesitter", group_index = 2 },
{ name = "spell", group_index = 2 },
})

-- Enhanced sorting
opts.sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
}

-- File type specific configurations
vim.api.nvim_create_autocmd("FileType", {
pattern = { "yaml", "yml" },
callback = function()
cmp.setup.buffer({
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "path" },
{ name = "spell" },
}),
})
end,
})

vim.api.nvim_create_autocmd("FileType", {
pattern = { "terraform", "tf" },
callback = function()
cmp.setup.buffer({
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "path" },
}),
})
end,
})

return opts
end,
},
}
182 changes: 182 additions & 0 deletions config/nvim-lazyvim/lua/plugins/lsp-comprehensive.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
-- Comprehensive LSP configuration for multiple languages and file types
-- Covers: Python, PowerShell, Bash, Azure Bicep, DevOps pipelines, GitHub Actions,
-- YAML, CSV, Go, Markdown, SQL, Terraform, Docker/Dockerfile

return {
"neovim/nvim-lspconfig",
dependencies = {
"mason.nvim",
"mason-org/mason-lspconfig.nvim",
},
opts = function(_, opts)
local function has(cmd)
return vim.fn.executable(cmd) == 1
end

opts.servers = opts.servers or {}

-- YAML LSP - essential for Azure DevOps, GitHub Actions, Kubernetes, etc.
opts.servers.yamlls = {
settings = {
yaml = {
hover = true,
completion = true,
validate = true,
schemaStore = {
enable = true,
url = "https://www.schemastore.org/api/json/catalog.json",
},
schemas = {
-- Azure DevOps Pipelines
["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = {
"azure-pipelines.yml",
"azure-pipelines.yaml",
".azure-pipelines.yml",
".azure-pipelines.yaml",
"pipelines/*.yml",
"pipelines/*.yaml",
".azure/pipelines/*.yml",
".azure/pipelines/*.yaml",
},
-- GitHub Actions
["https://json.schemastore.org/github-workflow.json"] = {
".github/workflows/*.yml",
".github/workflows/*.yaml",
},
-- GitHub Action (single)
["https://json.schemastore.org/github-action.json"] = {
"action.yml",
"action.yaml",
},
-- Docker Compose
["https://json.schemastore.org/docker-compose.json"] = {
"docker-compose.yml",
"docker-compose.yaml",
"compose.yml",
"compose.yaml",
},
-- Kubernetes
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
["https://kubernetesjsonschema.dev/v1.18.0-standalone-strict/all.json"] = "*.k8s.yaml",
},
},
},
}

-- Terraform LSP
opts.servers.terraformls = {
filetypes = { "terraform", "tf", "terraform-vars" },
settings = {
terraform = {
validate = true,
},
},
}

-- Dockerfile LSP
opts.servers.dockerls = {
filetypes = { "dockerfile" },
settings = {
docker = {
languageserver = {
formatter = {
ignoreMultilineInstructions = true,
},
},
},
},
}

-- Azure Bicep LSP (when Azure CLI is available)
if has("az") then
opts.servers.bicep = {
filetypes = { "bicep" },
settings = {},
}
end

-- Markdown LSP
opts.servers.marksman = {
filetypes = { "markdown", "md" },
settings = {},
}

-- Go LSP (enhanced configuration)
if has("go") then
opts.servers.gopls = {
settings = {
gopls = {
analyses = {
unusedparams = true,
shadow = true,
fieldalignment = true,
nilness = true,
},
staticcheck = true,
gofumpt = true,
usePlaceholders = true,
completeUnimported = true,
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
},
},
}
end

-- SQL LSPs
opts.servers.sqlls = {
filetypes = { "sql", "mysql", "pgsql" },
settings = {},
}

-- Enhanced Python LSP
if has("python") or has("python3") then
opts.servers.pyright = {
settings = {
python = {
analysis = {
typeCheckingMode = "basic",
autoSearchPaths = true,
useLibraryCodeForTypes = true,
autoImportCompletions = true,
},
},
},
}
end

-- JSON LSP with schema support for various file types
opts.servers.jsonls = {
settings = {
json = {
schemas = {
{
fileMatch = { "package.json" },
url = "https://json.schemastore.org/package.json",
},
{
fileMatch = { "tsconfig*.json" },
url = "https://json.schemastore.org/tsconfig.json",
},
{
fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" },
url = "https://json.schemastore.org/prettierrc.json",
},
{
fileMatch = { ".eslintrc", ".eslintrc.json" },
url = "https://json.schemastore.org/eslintrc.json",
},
{
fileMatch = { "azure-pipelines.json", ".azure-pipelines.json" },
url = "https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json",
},
},
},
},
}

-- CSV LSP (using rainbow_csv for syntax highlighting)
-- Note: This is handled by the rainbow_csv plugin, not LSP

return opts
end,
}
49 changes: 49 additions & 0 deletions config/nvim-lazyvim/lua/plugins/lsp-csv-support.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- CSV file handling with Rainbow CSV plugin
-- Provides syntax highlighting and table operations for CSV files

return {
{
"mechatroner/rainbow_csv",
ft = { "csv", "tsv", "csv_semicolon", "csv_whitespace", "csv_pipe", "rfc_csv" },
config = function()
-- Rainbow CSV configuration
vim.g.rainbow_csv_max_columns = 100
vim.g.rainbow_csv_delim_policy = "quoted"

-- Key mappings for CSV operations
vim.api.nvim_create_autocmd("FileType", {
pattern = { "csv", "tsv" },
callback = function()
local opts = { buffer = true, silent = true }
vim.keymap.set("n", "<leader>ca", ":RainbowAlign<CR>",
vim.tbl_extend("force", opts, { desc = "Align CSV columns" }))
vim.keymap.set("n", "<leader>cs", ":RainbowShrink<CR>",
vim.tbl_extend("force", opts, { desc = "Shrink CSV columns" }))
vim.keymap.set("n", "<leader>cq", ":RainbowMultiDelim<CR>",
vim.tbl_extend("force", opts, { desc = "Query CSV" }))
end,
})
end,
},

-- Enhanced completion for CSV files
{
"hrsh7th/nvim-cmp",
dependencies = { "mechatroner/rainbow_csv" },
opts = function(_, opts)
-- Add CSV-specific completion sources when in CSV files
vim.api.nvim_create_autocmd("FileType", {
pattern = { "csv", "tsv" },
callback = function()
local cmp = require("cmp")
cmp.setup.buffer({
sources = cmp.config.sources({
{ name = "buffer" },
{ name = "path" },
}),
})
end,
})
end,
},
}
Loading