feat(lsp): yaml schemas and lua bindings

This commit is contained in:
Ruslan
2026-06-27 12:31:03 +03:00
parent e1949666b1
commit 60f924c1d5
+26 -8
View File
@@ -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
}