From 60f924c1d566d00a48b9d59b03de6275d03833a5 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Sat, 27 Jun 2026 12:31:03 +0300 Subject: [PATCH] feat(lsp): yaml schemas and lua bindings --- lua/crentist/lazy/lsp.lua | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/lua/crentist/lazy/lsp.lua b/lua/crentist/lazy/lsp.lua index d222067..3b3ea13 100644 --- a/lua/crentist/lazy/lsp.lua +++ b/lua/crentist/lazy/lsp.lua @@ -15,13 +15,16 @@ return { library = { -- See the configuration section for more details -- Load luvit types when the `vim.uv` word is found - { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + { path = '/usr/share/swayimg/', words = { 'swayimg' } }, + { path = '/usr/share/hypr/stubs', words = { 'hypr' } }, }, }, }, }, config = function() + vim.lsp.codelens.enable(true) vim.diagnostic.config({ virtual_text = false }) -- load snippets from friendly-snippets @@ -44,12 +47,14 @@ return { 'terraformls', 'helm_ls', 'marksman', + 'buf_ls', + 'tflint', }, }) local lazydev = require('lazydev') vim.lsp.config('lua_ls', { - root_dir = function(bufnr, on_dir) on_dir(lazydev.find_workspace(bufnr)) end + root_dir = function(bufnr, on_dir) on_dir(lazydev.find_workspace(bufnr)) end, }) ---@module 'lspconfig' @@ -81,19 +86,32 @@ return { } }) + local schemas_dir = vim.fs.joinpath(vim.fn.stdpath('config'), '/schemas') vim.lsp.config('yamlls', { - filetypes = { 'yaml' }, + filetypes = { 'yaml', 'yaml.gitlab' }, settings = { - yaml = { enable = true, }, + yaml = { + schemaStore = { enable = false }, + schemas = { + ['https://gitlab.com/gitlab-org/gitlab-foss/-/raw/master/app/assets/javascripts/editor/schema/ci.json'] = { + '**/*.gitlab-ci.yml', + '**/pipelines/*.yml', + '**/pipelines/*.yaml', + }, + [vim.fs.joinpath(schemas_dir, '/vector-v0.53.0-schema.json')] = { + '**/vector.yaml' + }, + ['https://github.com/SchemaStore/schemastore/raw/refs/heads/master/src/schemas/json/kustomization.json'] = { + '**/kustomization.yaml' + } + } + }, } }) vim.lsp.config('terraformls', { filetypes = { 'terraform', 'terraform-vars' }, - -- run terraformls once for a git repo - root_dir = function(bufnr, on_dir) - on_dir(vim.fs.root(bufnr, '.git')) - end + root_markers = { { 'main.tf', '.terraform.lock.hcl' }, '.git' } }) end }