mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-18 21:17:23 +00:00
Merge pull request #1584 from snoweuph/feat/sml
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Treewide Checks / Validate flake (push) Has been cancelled
Treewide Checks / Check formatting (push) Has been cancelled
Treewide Checks / Check source tree for typos (push) Has been cancelled
Treewide Checks / Validate documentation builds (push) Has been cancelled
Treewide Checks / Validate documentation builds-1 (push) Has been cancelled
Treewide Checks / Validate documentation builds-2 (push) Has been cancelled
Treewide Checks / Validate documentation builds-3 (push) Has been cancelled
Treewide Checks / Validate hyperlinks in documentation sources (push) Has been cancelled
Treewide Checks / Validate Editorconfig conformance (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Treewide Checks / Validate flake (push) Has been cancelled
Treewide Checks / Check formatting (push) Has been cancelled
Treewide Checks / Check source tree for typos (push) Has been cancelled
Treewide Checks / Validate documentation builds (push) Has been cancelled
Treewide Checks / Validate documentation builds-1 (push) Has been cancelled
Treewide Checks / Validate documentation builds-2 (push) Has been cancelled
Treewide Checks / Validate documentation builds-3 (push) Has been cancelled
Treewide Checks / Validate hyperlinks in documentation sources (push) Has been cancelled
Treewide Checks / Validate Editorconfig conformance (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
languages/standard-ml: init
This commit is contained in:
commit
cd45295f9c
9 changed files with 166 additions and 4 deletions
|
|
@ -115,6 +115,7 @@ isMaximal: {
|
|||
fluent.enable = false;
|
||||
jq.enable = false;
|
||||
fish.enable = false;
|
||||
standard-ml.enable = false;
|
||||
|
||||
# Nim LSP is broken on Darwin and therefore
|
||||
# should be disabled by default. Users may still enable
|
||||
|
|
|
|||
|
|
@ -291,6 +291,10 @@
|
|||
|
||||
[Snoweuph](https://github.com/snoweuph)
|
||||
|
||||
- Allow the usage of `pks.tree-sitter-grammars` in
|
||||
{option}`vim.treesitter.grammars` and language module tree-sitter package
|
||||
options created via `mkGrammarOption`.
|
||||
|
||||
- Add `emmet-ls` to the supported LSPs for all languages it supports.
|
||||
|
||||
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
||||
|
|
@ -403,6 +407,8 @@
|
|||
- Added [`biomejs`](https://biomejs.dev/) as extra diagnostics provider to
|
||||
`languages.ts`.
|
||||
|
||||
- Added `languages.standard-ml`.
|
||||
|
||||
- Added `languages.vue`.
|
||||
|
||||
- Add `languages.fluent` using the official plugin. This only provides
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
in {
|
||||
inherit (typesDag) dagOf;
|
||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||
inherit (typesLanguage) diagnostics mkGrammarOption mkTreesitterGrammarOption;
|
||||
inherit (typesLsp) mkLspPresetEnableOption;
|
||||
inherit (customTypes) char hexColor mergelessListOf deprecatedSingleOrListOf enumWithRename;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,17 @@
|
|||
default = ["vimPlugins" "nvim-treesitter" "grammarPlugins" grammar];
|
||||
nullable = true;
|
||||
};
|
||||
|
||||
# Prefer using `mkGrammarOption` and only use this, for grammars,
|
||||
# not in `vimPlugins.nvim-treesitter.grammarPlugins`.
|
||||
# Grammars from `tree-sitter-grammars.tree-sitter-<name>` should mostly
|
||||
# just work, but should be tested extra, as we currently only use them
|
||||
# for a small subset of language modules.
|
||||
mkTreesitterGrammarOption = pkgs: grammar:
|
||||
mkPackageOption pkgs ["${grammar} treesitter"] {
|
||||
default = ["tree-sitter-grammars" "tree-sitter-${grammar}"];
|
||||
nullable = true;
|
||||
};
|
||||
in {
|
||||
inherit diagnostics diagnosticSubmodule mkGrammarOption;
|
||||
inherit diagnostics diagnosticSubmodule mkGrammarOption mkTreesitterGrammarOption;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ in {
|
|||
./clojure.nix
|
||||
./cmake.nix
|
||||
./css.nix
|
||||
./standard-ml.nix
|
||||
./scss.nix
|
||||
./elixir.nix
|
||||
./elm.nix
|
||||
|
|
|
|||
114
modules/plugins/languages/standard-ml.nix
Normal file
114
modules/plugins/languages/standard-ml.nix
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) literalExpression mkEnableOption mkOption;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.attrsets) attrNames genAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkTreesitterGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.standard-ml;
|
||||
|
||||
defaultServers = ["millet"];
|
||||
servers = ["millet"];
|
||||
|
||||
defaultFormat = ["smlfmt"];
|
||||
formats = {
|
||||
smlfmt = {
|
||||
command = getExe pkgs.smlfmt;
|
||||
stdin = false;
|
||||
args = mkLuaInline ''
|
||||
function(self, ctx)
|
||||
return {
|
||||
"--force",
|
||||
"-tab-width", ctx.shiftwidth,
|
||||
"-indent-width", ctx.shiftwidth,
|
||||
"$FILENAME",
|
||||
}
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.standard-ml = {
|
||||
enable = mkEnableOption "Standard ML support";
|
||||
|
||||
treesitter = {
|
||||
enable =
|
||||
mkEnableOption "Standard ML treesitter"
|
||||
// {
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
||||
};
|
||||
package = mkTreesitterGrammarOption pkgs "sml";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable =
|
||||
mkEnableOption "Standard ML LSP support"
|
||||
// {
|
||||
default = config.vim.lsp.enable;
|
||||
defaultText = literalExpression "config.vim.lsp.enable";
|
||||
};
|
||||
servers = mkOption {
|
||||
type = listOf (enum servers);
|
||||
default = defaultServers;
|
||||
description = "Standard ML LSP server to use";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable =
|
||||
mkEnableOption "Standard ML formatting"
|
||||
// {
|
||||
default = config.vim.languages.enableFormat;
|
||||
defaultText = literalExpression "config.vim.languages.enableFormat";
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
description = "Standard ML formatter to use";
|
||||
type = listOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter = {
|
||||
enable = true;
|
||||
grammars = [cfg.treesitter.package];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp = {
|
||||
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
|
||||
servers = genAttrs cfg.lsp.servers (_: {
|
||||
filetypes = ["sml"];
|
||||
});
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft.sml = cfg.format.type;
|
||||
formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
./lua-language-server.nix
|
||||
./markdown-oxide.nix
|
||||
./marksman.nix
|
||||
./millet.nix
|
||||
./neocmakelsp.nix
|
||||
./nil.nix
|
||||
./nimlsp.nix
|
||||
|
|
|
|||
24
modules/plugins/lsp/presets/millet.nix
Normal file
24
modules/plugins/lsp/presets/millet.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.types) mkLspPresetEnableOption;
|
||||
|
||||
cfg = config.vim.lsp.presets.millet;
|
||||
in {
|
||||
options.vim.lsp.presets.millet = {
|
||||
enable = mkLspPresetEnableOption "millet" "Millet Standard ML" [];
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim.lsp.servers.millet = {
|
||||
enable = true;
|
||||
cmd = [(getExe pkgs.millet)];
|
||||
root_markers = [".git" "millet.toml"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -41,8 +41,12 @@ in {
|
|||
'';
|
||||
description = ''
|
||||
List of treesitter grammars to install. For grammars to be installed properly,
|
||||
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.parsers` or `pkgs.vimPlugins.nvim-treesitter.grammarPlugins`.
|
||||
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
|
||||
you must use grammars from one of those:
|
||||
- `pkgs.vimPlugins.nvim-treesitter.parsers`
|
||||
- `pkgs.vimPlugins.nvim-treesitter.grammarPlugins`
|
||||
- `pkgs.tree-sitter-grammars` (mostly untested)
|
||||
|
||||
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars shipped with `nvim-treesitter`.
|
||||
|
||||
For languages already supported by nvf, you may use
|
||||
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue