-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(extra): add yaml language extension (#1198)
* feat: add yaml language extension * fix(yaml): disable keyOrdering checks --------- Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
- Loading branch information
1 parent
9fe89f5
commit 6dc6685
Showing
1 changed file
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
return { | ||
|
||
-- add yaml specific modules to treesitter | ||
{ | ||
"nvim-treesitter/nvim-treesitter", | ||
opts = function(_, opts) | ||
if type(opts.ensure_installed) == "table" then | ||
vim.list_extend(opts.ensure_installed, { "yaml" }) | ||
end | ||
end, | ||
}, | ||
|
||
-- correctly setup lspconfig | ||
{ | ||
"neovim/nvim-lspconfig", | ||
dependencies = { | ||
"b0o/SchemaStore.nvim", | ||
version = false, -- last release is way too old | ||
}, | ||
opts = { | ||
-- make sure mason installs the server | ||
servers = { | ||
yamlls = { | ||
-- lazy-load schemastore when needed | ||
on_new_config = function(new_config) | ||
new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {} | ||
vim.list_extend(new_config.settings.yaml.schemas, require("schemastore").yaml.schemas()) | ||
end, | ||
settings = { | ||
redhat = { telemetry = { enabled = false } }, | ||
yaml = { | ||
keyOrdering = false, | ||
format = { | ||
enable = true, | ||
}, | ||
validate = { enable = true }, | ||
schemaStore = { | ||
-- Must disable built-in schemaStore support to use | ||
-- schemas from SchemaStore.nvim plugin | ||
enable = false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} |