feat(lsp): yaml schemas and lua bindings
This commit is contained in:
@@ -16,12 +16,15 @@ return {
|
|||||||
-- See the configuration section for more details
|
-- See the configuration section for more details
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
-- 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()
|
config = function()
|
||||||
|
vim.lsp.codelens.enable(true)
|
||||||
vim.diagnostic.config({ virtual_text = false })
|
vim.diagnostic.config({ virtual_text = false })
|
||||||
|
|
||||||
-- load snippets from friendly-snippets
|
-- load snippets from friendly-snippets
|
||||||
@@ -44,12 +47,14 @@ return {
|
|||||||
'terraformls',
|
'terraformls',
|
||||||
'helm_ls',
|
'helm_ls',
|
||||||
'marksman',
|
'marksman',
|
||||||
|
'buf_ls',
|
||||||
|
'tflint',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local lazydev = require('lazydev')
|
local lazydev = require('lazydev')
|
||||||
vim.lsp.config('lua_ls', {
|
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'
|
---@module 'lspconfig'
|
||||||
@@ -81,19 +86,32 @@ return {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local schemas_dir = vim.fs.joinpath(vim.fn.stdpath('config'), '/schemas')
|
||||||
vim.lsp.config('yamlls', {
|
vim.lsp.config('yamlls', {
|
||||||
filetypes = { 'yaml' },
|
filetypes = { 'yaml', 'yaml.gitlab' },
|
||||||
settings = {
|
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', {
|
vim.lsp.config('terraformls', {
|
||||||
filetypes = { 'terraform', 'terraform-vars' },
|
filetypes = { 'terraform', 'terraform-vars' },
|
||||||
-- run terraformls once for a git repo
|
root_markers = { { 'main.tf', '.terraform.lock.hcl' }, '.git' }
|
||||||
root_dir = function(bufnr, on_dir)
|
|
||||||
on_dir(vim.fs.root(bufnr, '.git'))
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user