mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-03 02:15:50 +00:00
Merge pull request #1356 from snoweuph/feature/xml
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Treewide Checks / Validate flake (push) Waiting to run
Treewide Checks / Check formatting (push) Waiting to run
Treewide Checks / Check source tree for typos (push) Waiting to run
Treewide Checks / Validate documentation builds (push) Waiting to run
Treewide Checks / Validate documentation builds-1 (push) Waiting to run
Treewide Checks / Validate documentation builds-2 (push) Waiting to run
Treewide Checks / Validate documentation builds-3 (push) Waiting to run
Treewide Checks / Validate hyperlinks in documentation sources (push) Waiting to run
Treewide Checks / Validate Editorconfig conformance (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Treewide Checks / Validate flake (push) Waiting to run
Treewide Checks / Check formatting (push) Waiting to run
Treewide Checks / Check source tree for typos (push) Waiting to run
Treewide Checks / Validate documentation builds (push) Waiting to run
Treewide Checks / Validate documentation builds-1 (push) Waiting to run
Treewide Checks / Validate documentation builds-2 (push) Waiting to run
Treewide Checks / Validate documentation builds-3 (push) Waiting to run
Treewide Checks / Validate hyperlinks in documentation sources (push) Waiting to run
Treewide Checks / Validate Editorconfig conformance (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
language/xml: syntax highlighting, formatting, lsp
This commit is contained in:
commit
39813f0322
4 changed files with 66 additions and 0 deletions
|
|
@ -72,6 +72,7 @@ isMaximal: {
|
|||
extensions.crates-nvim.enable = isMaximal;
|
||||
};
|
||||
toml.enable = isMaximal;
|
||||
xml.enable = isMaximal;
|
||||
|
||||
# Language modules that are not as common.
|
||||
assembly.enable = false;
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@
|
|||
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
|
||||
`languages.lua`.
|
||||
|
||||
- Added XML syntax highlighting, LSP support and formatting
|
||||
|
||||
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
|
||||
https://github.com/gorbit99/codewindow.nvim
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ in {
|
|||
./yaml.nix
|
||||
./ruby.nix
|
||||
./just.nix
|
||||
./xml.nix
|
||||
|
||||
# This is now a hard deprecation.
|
||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||
|
|
|
|||
62
modules/plugins/languages/xml.nix
Normal file
62
modules/plugins/languages/xml.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.xml;
|
||||
|
||||
defaultServers = ["lemminx"];
|
||||
servers = {
|
||||
lemminx = {
|
||||
enable = true;
|
||||
cmd = [
|
||||
(getExe pkgs.lemminx)
|
||||
];
|
||||
filetypes = ["xml"];
|
||||
root_markers = [".git"];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.xml = {
|
||||
enable = mkEnableOption "XML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "XML treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "xml";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "XML LSP support" // {default = config.vim.lsp.enable;};
|
||||
servers = mkOption {
|
||||
type = listOf (enum (attrNames servers));
|
||||
default = defaultServers;
|
||||
description = "XML LSP server to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.servers =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = servers.${name};
|
||||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue