-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96f3271
commit 2015a0d
Showing
2 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
local function install_lsp_and_dap_if_needed() | ||
local INSTALL_THESE = { | ||
"yaml-language-server", -- LSP | ||
} | ||
for _, pkg in ipairs(INSTALL_THESE) do | ||
if not require("mason-registry").is_installed(pkg) then | ||
require("mason.api.command").MasonInstall({ pkg }) | ||
end | ||
end | ||
end | ||
|
||
local function configure_lsp() | ||
local lsp = require("language-server") | ||
local lsp_config_ok, lsp_config = pcall(require, "lspconfig") | ||
if not lsp_config_ok then | ||
return | ||
end | ||
|
||
lsp_config.yamlls.setup({ | ||
on_attach = on_attach, | ||
capabilities = capabilities, | ||
settings = { | ||
yaml = { | ||
schemas = { | ||
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", | ||
["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "/.gitlab-ci.yml", | ||
}, | ||
}, | ||
}, | ||
}) | ||
end | ||
|
||
local function configure() | ||
install_lsp_and_dap_if_needed() | ||
configure_lsp() | ||
end | ||
|
||
return { | ||
"local/yaml", | ||
config = configure, | ||
ft = "yaml", | ||
virtual = true, | ||
} |