mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-21 20:13:26 +00:00
Merge branch 'main' into fix/invalid-keys-in-haskell-tools
This commit is contained in:
commit
96097bf3ec
27 changed files with 1142 additions and 483 deletions
|
|
@ -80,6 +80,7 @@ isMaximal: {
|
||||||
xml.enable = isMaximal;
|
xml.enable = isMaximal;
|
||||||
tex.enable = isMaximal;
|
tex.enable = isMaximal;
|
||||||
docker.enable = isMaximal;
|
docker.enable = isMaximal;
|
||||||
|
env.enable = isMaximal;
|
||||||
|
|
||||||
# Language modules that are not as common.
|
# Language modules that are not as common.
|
||||||
openscad.enable = false;
|
openscad.enable = false;
|
||||||
|
|
@ -107,6 +108,7 @@ isMaximal: {
|
||||||
jinja.enable = false;
|
jinja.enable = false;
|
||||||
svelte.enable = false;
|
svelte.enable = false;
|
||||||
vue.enable = false;
|
vue.enable = false;
|
||||||
|
tsx.enable = false;
|
||||||
liquid.enable = false;
|
liquid.enable = false;
|
||||||
tera.enable = false;
|
tera.enable = false;
|
||||||
twig.enable = false;
|
twig.enable = false;
|
||||||
|
|
@ -114,6 +116,7 @@ isMaximal: {
|
||||||
fluent.enable = false;
|
fluent.enable = false;
|
||||||
jq.enable = false;
|
jq.enable = false;
|
||||||
fish.enable = false;
|
fish.enable = false;
|
||||||
|
standard-ml.enable = false;
|
||||||
|
|
||||||
# Nim LSP is broken on Darwin and therefore
|
# Nim LSP is broken on Darwin and therefore
|
||||||
# should be disabled by default. Users may still enable
|
# should be disabled by default. Users may still enable
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,4 @@
|
||||||
# LSP Custom Packages/Command {#sec-languages-custom-lsp-packages}
|
# LSP Customizations {#sec-lsp-customization}
|
||||||
|
|
||||||
One of the strengths of **nvf** is convenient aliases to quickly configure LSP
|
|
||||||
servers through the Nix module system. By default the LSP packages for relevant
|
|
||||||
language modules will be pulled into the closure. If this is not desirable, you
|
|
||||||
may provide **a custom LSP package** (e.g., a Bash script that calls a command)
|
|
||||||
or **a list of strings** to be interpreted as the command to launch the language
|
|
||||||
server. By using a list of strings, you can use this to skip automatic
|
|
||||||
installation of a language server, and instead use the one found in your `$PATH`
|
|
||||||
during runtime, for example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
vim.languages.java = {
|
|
||||||
lsp = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
# This expects 'jdt-language-server' to be in your PATH or in
|
|
||||||
# 'vim.extraPackages.' There are no additional checks performed to see
|
|
||||||
# if the command provided is valid.
|
|
||||||
package = ["jdt-language-server" "-data" "~/.cache/jdtls/workspace"];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Custom LSP Servers {#ch-custom-lsp-servers}
|
|
||||||
|
|
||||||
Neovim 0.11, in an effort to improve the out-of-the-box experience of Neovim,
|
Neovim 0.11, in an effort to improve the out-of-the-box experience of Neovim,
|
||||||
has introduced a new `vim.lsp` API that can be used to register custom LSP
|
has introduced a new `vim.lsp` API that can be used to register custom LSP
|
||||||
|
|
@ -30,18 +6,50 @@ servers with ease. In **nvf**, this translates to the custom `vim.lsp` API that
|
||||||
can be used to register servers that are not present in existing language
|
can be used to register servers that are not present in existing language
|
||||||
modules.
|
modules.
|
||||||
|
|
||||||
The {option}`vim.lsp.servers` submodule can be used to modify existing LSP
|
The {option}`vim.lsp.servers` submodule mirrors the `vim.lsp.config` lua API,
|
||||||
definitions OR register your own custom LSPs respectively. For example, if you'd
|
and can be used to modify existing LSP definitions OR register your own custom
|
||||||
like to avoid having NVF pull the LSP packages you may modify the start command
|
LSPs.
|
||||||
to use a string, which will cause the LSP API to discover LSP servers from
|
|
||||||
{env}`PATH`. For example:
|
## Configuring LSP presets {#ch-configuring-lsp-presets}
|
||||||
|
|
||||||
|
LSP presets provided by NVF via `vim.languages.*.lsp` can be further customized
|
||||||
|
with the {option}`vim.lsp.servers` submodule.
|
||||||
|
|
||||||
|
For example, if you'd like to avoid having NVF pull the LSP packages you may
|
||||||
|
modify the start command to use a string, which will cause the LSP API to
|
||||||
|
discover LSP servers from {env}`PATH`.
|
||||||
|
|
||||||
|
An example for **modifying a preset** provided by NVF via `vim.languages.*.lsp`:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{lib, ...}: {
|
{lib, ...}: {
|
||||||
|
vim.languages.python = {
|
||||||
|
enable = true;
|
||||||
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# This is already the default value, we're just writing this down for
|
||||||
|
# clarity
|
||||||
|
servers = ["basedpyright"]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
vim.lsp.servers = {
|
vim.lsp.servers = {
|
||||||
# Get `basedpyright-langserver` from PATH, e.g., a dev shell.
|
# Get `basedpyright-langserver` from PATH, e.g., a dev shell.
|
||||||
basedpyright.cmd = lib.mkForce ["basedpyright-langserver" "--stdio"];
|
basedpyright.cmd = lib.mkForce ["basedpyright-langserver" "--stdio"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding custom LSP Servers {#ch-custom-lsp}
|
||||||
|
|
||||||
|
{option}`vim.lsp.servers` is also used to add your custom LSP definitions.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{lib, ...}: {
|
||||||
|
vim.lsp.servers = {
|
||||||
# Define a custom LSP entry using `vim.lsp.servers`:
|
# Define a custom LSP entry using `vim.lsp.servers`:
|
||||||
ty = {
|
ty = {
|
||||||
cmd = lib.mkDefault [(lib.getExe pkgs.ty) "server"];
|
cmd = lib.mkDefault [(lib.getExe pkgs.ty) "server"];
|
||||||
|
|
@ -55,9 +63,10 @@ to use a string, which will cause the LSP API to discover LSP servers from
|
||||||
"pyrightconfig.json"
|
"pyrightconfig.json"
|
||||||
];
|
];
|
||||||
|
|
||||||
# If your LSP accepts custom settings. See `:help lsp-config` for more details
|
# If your LSP accepts custom settings. See `:help lsp-config` for more
|
||||||
# on available fields. This is a freeform field.
|
# details on available fields. This is a freeform field.
|
||||||
settings.ty = { /* ... */ };
|
settings.ty = { /* ... */ };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,10 @@
|
||||||
SCSS/SASS. This also changes the default LSP to `some-sass-language-server`
|
SCSS/SASS. This also changes the default LSP to `some-sass-language-server`
|
||||||
for SCSS/SASS.
|
for SCSS/SASS.
|
||||||
|
|
||||||
|
- Split React/TSX from `languages.typescript` into `languages.tsx`. This new
|
||||||
|
module provides jsx/tsx support. This is a step of cleaning up the Typescript
|
||||||
|
module for the future.
|
||||||
|
|
||||||
[CaueAnjos](https://github.com/caueanjos)
|
[CaueAnjos](https://github.com/caueanjos)
|
||||||
|
|
||||||
- Renamed `roslyn_ls` to `roslyn-ls`
|
- Renamed `roslyn_ls` to `roslyn-ls`
|
||||||
|
|
@ -301,6 +305,10 @@
|
||||||
|
|
||||||
[Snoweuph](https://github.com/snoweuph)
|
[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.
|
- Add `emmet-ls` to the supported LSPs for all languages it supports.
|
||||||
|
|
||||||
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
||||||
|
|
@ -408,11 +416,15 @@
|
||||||
|
|
||||||
- Added `asmfmt` and `nasmfmt` formatters to `languages.asm`.
|
- Added `asmfmt` and `nasmfmt` formatters to `languages.asm`.
|
||||||
|
|
||||||
|
- Added `astyle`, `indent` and `clang-format` to `languages.clang` formatters.
|
||||||
|
|
||||||
- Added `biome-check` and `biome-organize-imports` formatters to `languages.ts`.
|
- Added `biome-check` and `biome-organize-imports` formatters to `languages.ts`.
|
||||||
|
|
||||||
- Added [`biomejs`](https://biomejs.dev/) as extra diagnostics provider to
|
- Added [`biomejs`](https://biomejs.dev/) as extra diagnostics provider to
|
||||||
`languages.ts`.
|
`languages.ts`.
|
||||||
|
|
||||||
|
- Added `languages.standard-ml`.
|
||||||
|
|
||||||
- Added `languages.vue`.
|
- Added `languages.vue`.
|
||||||
|
|
||||||
- Add `languages.fluent` using the official plugin. This only provides
|
- Add `languages.fluent` using the official plugin. This only provides
|
||||||
|
|
@ -420,6 +432,8 @@
|
||||||
|
|
||||||
- Add `languages.gettext`. This only provides highlighting.
|
- Add `languages.gettext`. This only provides highlighting.
|
||||||
|
|
||||||
|
- Add `languages.env`. This provides extra filetype hooks and diagnostics.
|
||||||
|
|
||||||
- Add `languages.openscad` using
|
- Add `languages.openscad` using
|
||||||
[`openscad-lsp`](https://github.com/Leathong/openscad-LSP). This currently
|
[`openscad-lsp`](https://github.com/Leathong/openscad-LSP). This currently
|
||||||
relies on neovim builtin syntax for highlighting, and the lsp for formatting
|
relies on neovim builtin syntax for highlighting, and the lsp for formatting
|
||||||
|
|
@ -503,6 +517,12 @@ https://github.com/gorbit99/codewindow.nvim
|
||||||
[poseidon-rises](https://github.com/poseidon-rises) in
|
[poseidon-rises](https://github.com/poseidon-rises) in
|
||||||
[!1107](https://github.com/NotAShelf/nvf/pull/1107).
|
[!1107](https://github.com/NotAShelf/nvf/pull/1107).
|
||||||
|
|
||||||
|
[emo-mruczek](https://emo-mruczek.pet):
|
||||||
|
|
||||||
|
[vhdl-ls]: https://github.com/VHDL-LS/rust_hdl
|
||||||
|
|
||||||
|
- Add VHDL support with [vhdl-ls].
|
||||||
|
|
||||||
[itscrystalline](https://github.com/itscrystalline):
|
[itscrystalline](https://github.com/itscrystalline):
|
||||||
|
|
||||||
[img-clip.nvim]: https://github.com/hakonharnes/img-clip.nvim
|
[img-clip.nvim]: https://github.com/hakonharnes/img-clip.nvim
|
||||||
|
|
@ -547,4 +567,16 @@ https://github.com/gorbit99/codewindow.nvim
|
||||||
- Allow `vim.treesitter.context.setupOpts.max_lines` to also be given as a
|
- Allow `vim.treesitter.context.setupOpts.max_lines` to also be given as a
|
||||||
string in order to allow percentage values like `"20%"`
|
string in order to allow percentage values like `"20%"`
|
||||||
|
|
||||||
|
[RoastedCheese](https://github.com/roastedcheese):
|
||||||
|
|
||||||
|
- Fix `golangci-lint` to lint at the package level.
|
||||||
|
|
||||||
|
[Poseidon](https://github.com/poseidon-rises)
|
||||||
|
|
||||||
|
[PHPStan]: https://github.com/phpstan/phpstan
|
||||||
|
|
||||||
|
- Add [PHPStan] as a formatter for `vim.languages.php`.
|
||||||
|
- Add `prettier` and `prettierd` as supported formatters to
|
||||||
|
`vim.languages.json`.
|
||||||
|
|
||||||
<!-- vim: set textwidth=80: -->
|
<!-- vim: set textwidth=80: -->
|
||||||
|
|
|
||||||
34
flake.lock
generated
34
flake.lock
generated
|
|
@ -3,11 +3,11 @@
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1751685974,
|
"lastModified": 1777699697,
|
||||||
"narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=",
|
"narHash": "sha256-Eg9b/rq/ECYwNwEXs5i9wHyhxNI0JrYx2srdI2uZMaQ=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1",
|
"rev": "382052b74656a369c5408822af3f2501e9b1af81",
|
||||||
"revCount": 92,
|
"revCount": 94,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.lix.systems/lix-project/flake-compat.git"
|
"url": "https://git.lix.systems/lix-project/flake-compat.git"
|
||||||
},
|
},
|
||||||
|
|
@ -23,11 +23,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1769996383,
|
"lastModified": 1778716662,
|
||||||
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
|
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
|
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777828893,
|
"lastModified": 1778541201,
|
||||||
"narHash": "sha256-gVWVnmyNr74BVKfhMMZDWkhx2699dhmZ2g0W8TTHtkk=",
|
"narHash": "sha256-n0twkzWexzjsoDycOTvvQNuGEdg62UiNHYcFCduYpKI=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "c1c0b544bfabe6669b5a6a0383ccb475fe60258b",
|
"rev": "1a3573fc9d2486738fe0b2cacc5cd10dd5f3a445",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -58,27 +58,27 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776882296,
|
"lastModified": 1779233504,
|
||||||
"narHash": "sha256-DWZozXwMsgvUqfVlL1mQ8dOxW7GJ/8CdyaDN+1niZRg=",
|
"narHash": "sha256-YIKEyzh0NFQlD0O92LQQNMoVCDwV8yw1Xz0Iu+4ZC5U=",
|
||||||
"owner": "feel-co",
|
"owner": "feel-co",
|
||||||
"repo": "ndg",
|
"repo": "ndg",
|
||||||
"rev": "ab7d78d4884b3a34968cf9fa3d16c0c1246d5c6e",
|
"rev": "86f6644411a64d5413711895b7cf6e0e1be465b6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "feel-co",
|
"owner": "feel-co",
|
||||||
"ref": "refs/tags/v2.6.0",
|
"ref": "refs/tags/v2.8.0",
|
||||||
"repo": "ndg",
|
"repo": "ndg",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774386573,
|
"lastModified": 1778869304,
|
||||||
"narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=",
|
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9",
|
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@
|
||||||
|
|
||||||
# Alternative documentation generator
|
# Alternative documentation generator
|
||||||
ndg = {
|
ndg = {
|
||||||
url = "github:feel-co/ndg?ref=refs/tags/v2.6.0";
|
url = "github:feel-co/ndg?ref=refs/tags/v2.8.0";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
{
|
{
|
||||||
|
pins,
|
||||||
stdenv,
|
stdenv,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
nodejs,
|
nodejs,
|
||||||
pnpm_9,
|
pnpm_9,
|
||||||
pnpmConfigHook,
|
pnpmConfigHook,
|
||||||
|
zstd,
|
||||||
fetchPnpmDeps,
|
fetchPnpmDeps,
|
||||||
pins,
|
|
||||||
writableTmpDirAsHomeHook,
|
writableTmpDirAsHomeHook,
|
||||||
}: let
|
}: let
|
||||||
pin = pins.prettier-plugin-astro;
|
pin = pins.prettier-plugin-astro;
|
||||||
|
pnpm = pnpm_9;
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "prettier-plugin-astro";
|
pname = "prettier-plugin-astro";
|
||||||
|
|
@ -21,18 +23,20 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
pnpmDeps = fetchPnpmDeps {
|
pnpmDeps = fetchPnpmDeps {
|
||||||
pnpm = pnpm_9;
|
inherit pnpm;
|
||||||
inherit (finalAttrs) pname src;
|
inherit (finalAttrs) pname version src;
|
||||||
fetcherVersion = 2;
|
hash = "sha256-vs7KOsX+jmnY2+RKJlhSWDVyTUxAO2af3lyao9AYFr8=";
|
||||||
hash = "sha256-K7pIWLkIIbUKDIcysfEtcf/eVMX9ZgyFHdqcuycHCNE=";
|
fetcherVersion = 3; # https://nixos.org/manual/nixpkgs/stable/#javascript-pnpm-fetcherVersion
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
nodejs
|
nodejs
|
||||||
writableTmpDirAsHomeHook
|
writableTmpDirAsHomeHook
|
||||||
(pnpmConfigHook.overrideAttrs {
|
(pnpmConfigHook.override {
|
||||||
propagatedBuildInputs = [pnpm_9];
|
inherit pnpm;
|
||||||
})
|
})
|
||||||
|
pnpm
|
||||||
|
zstd
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|
@ -43,13 +47,8 @@ in
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
preInstall = ''
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
# mkdir -p $out/dist
|
|
||||||
cp -r dist/ $out
|
cp -r dist/ $out
|
||||||
cp -r node_modules $out
|
cp -r node_modules $out
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ in
|
||||||
sha256 = pin.hash;
|
sha256 = pin.hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
npmDepsHash = "sha256-XVyLW0XDCvZCZxu8g1fP7fRfeU3Hz81o5FCi/i4BKQw=";
|
npmDepsHash = "sha256-zejYnwkj6CBWOqA6LBYBEXMg0jT2vJqinBwzKdWIqpY=";
|
||||||
|
|
||||||
dontNpmPrune = true;
|
dontNpmPrune = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption mkTreesitterGrammarOption;
|
||||||
inherit (typesLsp) mkLspPresetEnableOption;
|
inherit (typesLsp) mkLspPresetEnableOption;
|
||||||
inherit (customTypes) char hexColor mergelessListOf deprecatedSingleOrListOf enumWithRename;
|
inherit (customTypes) char hexColor mergelessListOf deprecatedSingleOrListOf enumWithRename;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,17 @@
|
||||||
default = ["vimPlugins" "nvim-treesitter" "grammarPlugins" grammar];
|
default = ["vimPlugins" "nvim-treesitter" "grammarPlugins" grammar];
|
||||||
nullable = true;
|
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 {
|
in {
|
||||||
inherit diagnostics diagnosticSubmodule mkGrammarOption;
|
inherit diagnostics diagnosticSubmodule mkGrammarOption mkTreesitterGrammarOption;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -373,5 +373,10 @@ in {
|
||||||
<https://strongly-typed-thoughts.net/blog/final-bye-github>
|
<https://strongly-typed-thoughts.net/blog/final-bye-github>
|
||||||
'')
|
'')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# 2026-05-16
|
||||||
|
[
|
||||||
|
(mkRenamedOptionModule ["vim" "languages" "typescript" "treesitter" "tsxPackage"] ["vim" "languages" "tsx" "treesitter" "package"])
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,12 @@
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.types) bool enum package listOf;
|
inherit (lib.types) bool enum package listOf;
|
||||||
inherit (lib) genAttrs;
|
inherit (lib) genAttrs;
|
||||||
|
inherit (lib.meta) getExe getExe';
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
cfg = config.vim.languages.clang;
|
cfg = config.vim.languages.clang;
|
||||||
|
|
||||||
|
|
@ -45,6 +48,54 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultFormat = ["clang-format"];
|
||||||
|
formats = {
|
||||||
|
astyle = {
|
||||||
|
command = getExe pkgs.astyle;
|
||||||
|
stdin = false;
|
||||||
|
args = mkLuaInline ''
|
||||||
|
function(self, ctx)
|
||||||
|
local args = {
|
||||||
|
"$FILENAME",
|
||||||
|
}
|
||||||
|
|
||||||
|
if not vim.bo[ctx.buf].expandtab then
|
||||||
|
table.insert(args, "--indent=tab=" .. ctx.shiftwidth)
|
||||||
|
else
|
||||||
|
table.insert(args, "--indent=spaces=" .. ctx.shiftwidth)
|
||||||
|
end
|
||||||
|
|
||||||
|
return args
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
indent = {
|
||||||
|
command = getExe pkgs.indent;
|
||||||
|
stdin = true;
|
||||||
|
args = mkLuaInline ''
|
||||||
|
function(self, ctx)
|
||||||
|
local args = {
|
||||||
|
"--indent-level", ctx.shiftwidth,
|
||||||
|
"--tab-size", ctx.shiftwidth,
|
||||||
|
}
|
||||||
|
|
||||||
|
if not vim.bo[ctx.buf].expandtab then
|
||||||
|
table.insert(args, "--use-tabs")
|
||||||
|
else
|
||||||
|
table.insert(args, "--no-tabs")
|
||||||
|
end
|
||||||
|
|
||||||
|
return args
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
# Default is GNU style. Nobody likes that one.
|
||||||
|
# This is under `append_args`, to allow easy editing of this argument,
|
||||||
|
# without having to redefine everything as a user.
|
||||||
|
append_args = ["--linux-style"];
|
||||||
|
};
|
||||||
|
clang-format.command = getExe' pkgs.clang-tools "clang-format";
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.clang = {
|
options.vim.languages.clang = {
|
||||||
enable = mkEnableOption "C/C++ language support";
|
enable = mkEnableOption "C/C++ language support";
|
||||||
|
|
@ -102,6 +153,21 @@ in {
|
||||||
default = debuggers.${cfg.dap.debugger}.package;
|
default = debuggers.${cfg.dap.debugger}.package;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "C formatting"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableFormat;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableFormat";
|
||||||
|
};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = listOf (enum (attrNames formats));
|
||||||
|
default = defaultFormat;
|
||||||
|
description = "C formatter to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -127,5 +193,23 @@ in {
|
||||||
vim.debugger.nvim-dap.enable = true;
|
vim.debugger.nvim-dap.enable = true;
|
||||||
vim.debugger.nvim-dap.sources.clang-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
vim.debugger.nvim-dap.sources.clang-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.formatter.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
c = cfg.format.type;
|
||||||
|
cpp = cfg.format.type;
|
||||||
|
};
|
||||||
|
formatters =
|
||||||
|
mapListToAttrs (name: {
|
||||||
|
inherit name;
|
||||||
|
value = formats.${name};
|
||||||
|
})
|
||||||
|
cfg.format.type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,67 +7,72 @@ in {
|
||||||
./asm.nix
|
./asm.nix
|
||||||
./astro.nix
|
./astro.nix
|
||||||
./bash.nix
|
./bash.nix
|
||||||
./cue.nix
|
|
||||||
./dart.nix
|
|
||||||
./clang.nix
|
./clang.nix
|
||||||
./clojure.nix
|
./clojure.nix
|
||||||
./cmake.nix
|
./cmake.nix
|
||||||
|
./csharp.nix
|
||||||
./css.nix
|
./css.nix
|
||||||
./scss.nix
|
./cue.nix
|
||||||
|
./dart.nix
|
||||||
|
./docker.nix
|
||||||
./elixir.nix
|
./elixir.nix
|
||||||
./elm.nix
|
./elm.nix
|
||||||
|
./env.nix
|
||||||
./fish.nix
|
./fish.nix
|
||||||
|
./fluent.nix
|
||||||
./fsharp.nix
|
./fsharp.nix
|
||||||
|
./gettext.nix
|
||||||
./gleam.nix
|
./gleam.nix
|
||||||
./glsl.nix
|
./glsl.nix
|
||||||
./go.nix
|
./go.nix
|
||||||
|
./haskell.nix
|
||||||
./hcl.nix
|
./hcl.nix
|
||||||
./helm.nix
|
./helm.nix
|
||||||
./kotlin.nix
|
|
||||||
./html.nix
|
./html.nix
|
||||||
./tera.nix
|
|
||||||
./twig.nix
|
|
||||||
./liquid.nix
|
|
||||||
./haskell.nix
|
|
||||||
./java.nix
|
./java.nix
|
||||||
./jinja.nix
|
./jinja.nix
|
||||||
|
./jq.nix
|
||||||
./json.nix
|
./json.nix
|
||||||
|
./julia.nix
|
||||||
|
./just.nix
|
||||||
|
./kotlin.nix
|
||||||
|
./liquid.nix
|
||||||
./lua.nix
|
./lua.nix
|
||||||
|
./make.nix
|
||||||
./markdown.nix
|
./markdown.nix
|
||||||
./tex.nix
|
|
||||||
./nim.nix
|
./nim.nix
|
||||||
./vala.nix
|
|
||||||
./nix.nix
|
./nix.nix
|
||||||
|
./nu.nix
|
||||||
./ocaml.nix
|
./ocaml.nix
|
||||||
|
./odin.nix
|
||||||
|
./openscad.nix
|
||||||
./php.nix
|
./php.nix
|
||||||
./python.nix
|
./python.nix
|
||||||
./qml.nix
|
./qml.nix
|
||||||
./r.nix
|
./r.nix
|
||||||
|
./ruby.nix
|
||||||
./rust.nix
|
./rust.nix
|
||||||
./scala.nix
|
./scala.nix
|
||||||
|
./scss.nix
|
||||||
|
./scss.nix
|
||||||
./sql.nix
|
./sql.nix
|
||||||
|
./standard-ml.nix
|
||||||
./svelte.nix
|
./svelte.nix
|
||||||
./vue.nix
|
./tera.nix
|
||||||
./terraform.nix
|
./terraform.nix
|
||||||
|
./tex.nix
|
||||||
./toml.nix
|
./toml.nix
|
||||||
|
./tsx.nix
|
||||||
|
./twig.nix
|
||||||
./typescript.nix
|
./typescript.nix
|
||||||
./typst.nix
|
./typst.nix
|
||||||
./zig.nix
|
./vala.nix
|
||||||
./csharp.nix
|
./vhdl.nix
|
||||||
./julia.nix
|
./vue.nix
|
||||||
./nu.nix
|
|
||||||
./odin.nix
|
|
||||||
./wgsl.nix
|
./wgsl.nix
|
||||||
./yaml.nix
|
|
||||||
./ruby.nix
|
|
||||||
./just.nix
|
|
||||||
./make.nix
|
|
||||||
./xml.nix
|
./xml.nix
|
||||||
./gettext.nix
|
./yaml.nix
|
||||||
./fluent.nix
|
./zig.nix
|
||||||
./openscad.nix
|
|
||||||
./jq.nix
|
|
||||||
./docker.nix
|
|
||||||
|
|
||||||
# This is now a hard deprecation.
|
# This is now a hard deprecation.
|
||||||
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
|
||||||
|
|
|
||||||
70
modules/plugins/languages/env.nix
Normal file
70
modules/plugins/languages/env.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption literalExpression;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.types) diagnostics;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.env;
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["dotenv-linter"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
dotenv-linter = let
|
||||||
|
pkg = pkgs.dotenv-linter;
|
||||||
|
in {
|
||||||
|
package = pkg;
|
||||||
|
config = {
|
||||||
|
cmd = getExe pkg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.env = {
|
||||||
|
enable = mkEnableOption "Env language support";
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "extra Env diagnostics"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableExtraDiagnostics;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostics";
|
||||||
|
};
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Env";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
{
|
||||||
|
vim.autocmds = [
|
||||||
|
{
|
||||||
|
event = ["BufRead" "BufNewFile"];
|
||||||
|
pattern = [
|
||||||
|
# support common names like `dist.env`
|
||||||
|
"*.env"
|
||||||
|
# support weird env files names like symfony ones.
|
||||||
|
".env.*"
|
||||||
|
];
|
||||||
|
command = "set filetype=env";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.env = cfg.extraDiagnostics.types;
|
||||||
|
linters =
|
||||||
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -67,7 +67,21 @@
|
||||||
"--output.junit-xml.path="
|
"--output.junit-xml.path="
|
||||||
"--output.teamcity.path="
|
"--output.teamcity.path="
|
||||||
"--output.sarif.path="
|
"--output.sarif.path="
|
||||||
|
(mkLuaInline ''
|
||||||
|
-- Run on current file only if go.mod is missing
|
||||||
|
function()
|
||||||
|
local fnmod = ":p";
|
||||||
|
local cmd = {"${getExe pkgs.go}", "env", "GOMOD"};
|
||||||
|
local ok, gomod = pcall(vim.fn.system, cmd);
|
||||||
|
gomod = gomod:gsub("%s+", "")
|
||||||
|
if ok and gomod ~= "" and gomod ~= "/dev/null" then
|
||||||
|
fnmod = ":h";
|
||||||
|
end
|
||||||
|
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), fnmod)
|
||||||
|
end
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
|
append_fname = false;
|
||||||
parser = mkLuaInline ''
|
parser = mkLuaInline ''
|
||||||
function(output, bufnr)
|
function(output, bufnr)
|
||||||
local SOURCE = "golangci-lint";
|
local SOURCE = "golangci-lint";
|
||||||
|
|
@ -111,15 +125,19 @@
|
||||||
local normalized = issue.Severity:lower()
|
local normalized = issue.Severity:lower()
|
||||||
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
||||||
end
|
end
|
||||||
table.insert(diagnostics, {
|
|
||||||
bufnr = bufnr,
|
local buffer = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":p")
|
||||||
lnum = issue.Pos.Line - 1,
|
if vim.fs.normalize(buffer) == vim.fs.normalize(issue.Pos.Filename) then
|
||||||
col = issue.Pos.Column - 1,
|
table.insert(diagnostics, {
|
||||||
message = issue.Text,
|
bufnr = bufnr,
|
||||||
code = issue.FromLinter,
|
lnum = issue.Pos.Line - 1,
|
||||||
severity = sev,
|
col = issue.Pos.Column - 1,
|
||||||
source = SOURCE,
|
message = issue.Text,
|
||||||
})
|
code = issue.FromLinter,
|
||||||
|
severity = sev,
|
||||||
|
source = SOURCE,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return diagnostics
|
return diagnostics
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,14 @@
|
||||||
command = getExe pkgs.jsonfmt;
|
command = getExe pkgs.jsonfmt;
|
||||||
args = ["-w" "-"];
|
args = ["-w" "-"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
prettier = {
|
||||||
|
command = getExe pkgs.prettier;
|
||||||
|
};
|
||||||
|
|
||||||
|
prettierd = {
|
||||||
|
command = getExe pkgs.prettierd;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.json = {
|
options.vim.languages.json = {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum int attrs listOf;
|
inherit (lib.types) enum int attrs listOf;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
cfg = config.vim.languages.php;
|
cfg = config.vim.languages.php;
|
||||||
|
|
@ -33,6 +33,14 @@
|
||||||
command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer";
|
command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["phpstan"];
|
||||||
|
|
||||||
|
diagnosticsProviders = {
|
||||||
|
phpstan = {
|
||||||
|
config.cmd = getExe pkgs.phpstan;
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.php = {
|
options.vim.languages.php = {
|
||||||
enable = mkEnableOption "PHP language support";
|
enable = mkEnableOption "PHP language support";
|
||||||
|
|
@ -103,6 +111,21 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "extra PHP diagnostics"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableExtraDiagnostics;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostic";
|
||||||
|
};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "PHP";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -154,5 +177,15 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.php = cfg.extraDiagnostics.types;
|
||||||
|
linters =
|
||||||
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
159
modules/plugins/languages/tsx.nix
Normal file
159
modules/plugins/languages/tsx.nix
Normal file
|
|
@ -0,0 +1,159 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
|
inherit (lib.types) enum listOf;
|
||||||
|
inherit (lib.attrsets) attrNames genAttrs;
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.tsx;
|
||||||
|
|
||||||
|
defaultServers = ["typescript-language-server"];
|
||||||
|
servers = ["typescript-language-server" "deno" "typescript-go" "emmet-ls"];
|
||||||
|
|
||||||
|
defaultFormat = ["prettier"];
|
||||||
|
formats = {
|
||||||
|
prettier = {
|
||||||
|
command = getExe pkgs.prettier;
|
||||||
|
};
|
||||||
|
|
||||||
|
prettierd = {
|
||||||
|
command = getExe pkgs.prettierd;
|
||||||
|
};
|
||||||
|
|
||||||
|
biome = {
|
||||||
|
command = getExe pkgs.biome;
|
||||||
|
};
|
||||||
|
|
||||||
|
biome-check = {
|
||||||
|
command = getExe pkgs.biome;
|
||||||
|
};
|
||||||
|
|
||||||
|
biome-organize-imports = {
|
||||||
|
command = getExe pkgs.biome;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["biomejs"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
biomejs = let
|
||||||
|
pkg = pkgs.biome;
|
||||||
|
in {
|
||||||
|
package = pkg;
|
||||||
|
config = {
|
||||||
|
cmd = getExe pkg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.vim.languages.tsx = {
|
||||||
|
enable = mkEnableOption "Typescript XML (TSX) language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "Typescript XML (TSX) treesitter"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableTreesitter;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
||||||
|
};
|
||||||
|
package = mkGrammarOption pkgs "tsx";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "Typescript XML (TSX) LSP support"
|
||||||
|
// {
|
||||||
|
default = config.vim.lsp.enable;
|
||||||
|
defaultText = literalExpression "config.vim.lsp.enable";
|
||||||
|
};
|
||||||
|
servers = mkOption {
|
||||||
|
type = listOf (enum servers);
|
||||||
|
default = defaultServers;
|
||||||
|
description = "Typescript XML (TSX) LSP server to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
format = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "Typescript XML (TSX) formatting"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableFormat;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableFormat";
|
||||||
|
};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
description = "Typescript XML (TSX) formatter to use";
|
||||||
|
type = listOf (enum (attrNames formats));
|
||||||
|
default = defaultFormat;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Typescript XML (TSX) diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Typescript XML (TSX)";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = [
|
||||||
|
"typescriptreact"
|
||||||
|
"javascriptreact"
|
||||||
|
];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.format.enable {
|
||||||
|
vim.formatter.conform-nvim = {
|
||||||
|
enable = true;
|
||||||
|
setupOpts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
typescriptreact = cfg.format.type;
|
||||||
|
javascriptreact = cfg.format.type;
|
||||||
|
};
|
||||||
|
formatters =
|
||||||
|
mapListToAttrs (name: {
|
||||||
|
inherit name;
|
||||||
|
value = formats.${name};
|
||||||
|
})
|
||||||
|
cfg.format.type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft = {
|
||||||
|
typescriptreact = cfg.extraDiagnostics.types;
|
||||||
|
javascriptreact = cfg.extraDiagnostics.types;
|
||||||
|
};
|
||||||
|
linters =
|
||||||
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -85,7 +85,6 @@ in {
|
||||||
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
||||||
};
|
};
|
||||||
tsPackage = mkGrammarOption pkgs "typescript";
|
tsPackage = mkGrammarOption pkgs "typescript";
|
||||||
tsxPackage = mkGrammarOption pkgs "tsx";
|
|
||||||
jsPackage = mkGrammarOption pkgs "javascript";
|
jsPackage = mkGrammarOption pkgs "javascript";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -162,7 +161,6 @@ in {
|
||||||
vim.treesitter.enable = true;
|
vim.treesitter.enable = true;
|
||||||
vim.treesitter.grammars = [
|
vim.treesitter.grammars = [
|
||||||
cfg.treesitter.tsPackage
|
cfg.treesitter.tsPackage
|
||||||
cfg.treesitter.tsxPackage
|
|
||||||
cfg.treesitter.jsPackage
|
cfg.treesitter.jsPackage
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
@ -173,11 +171,6 @@ in {
|
||||||
servers = genAttrs cfg.lsp.servers (_: {
|
servers = genAttrs cfg.lsp.servers (_: {
|
||||||
filetypes = [
|
filetypes = [
|
||||||
"typescript"
|
"typescript"
|
||||||
# TODO: move to a React module
|
|
||||||
"typescriptreact"
|
|
||||||
"typescript.tsx"
|
|
||||||
"javascriptreact"
|
|
||||||
"javascript.jsx"
|
|
||||||
# TODO: move to a JavaScript module
|
# TODO: move to a JavaScript module
|
||||||
"javascript"
|
"javascript"
|
||||||
];
|
];
|
||||||
|
|
@ -192,8 +185,6 @@ in {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
typescript = cfg.format.type;
|
typescript = cfg.format.type;
|
||||||
javascript = cfg.format.type;
|
javascript = cfg.format.type;
|
||||||
# .tsx/.jsx files
|
|
||||||
typescriptreact = cfg.format.type;
|
|
||||||
};
|
};
|
||||||
formatters =
|
formatters =
|
||||||
mapListToAttrs (name: {
|
mapListToAttrs (name: {
|
||||||
|
|
@ -209,8 +200,6 @@ in {
|
||||||
vim.diagnostics.nvim-lint = {
|
vim.diagnostics.nvim-lint = {
|
||||||
enable = true;
|
enable = true;
|
||||||
linters_by_ft.typescript = cfg.extraDiagnostics.types;
|
linters_by_ft.typescript = cfg.extraDiagnostics.types;
|
||||||
linters_by_ft.typescriptreact = cfg.extraDiagnostics.types;
|
|
||||||
|
|
||||||
linters =
|
linters =
|
||||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
cfg.extraDiagnostics.types);
|
cfg.extraDiagnostics.types);
|
||||||
|
|
|
||||||
65
modules/plugins/languages/vhdl.nix
Normal file
65
modules/plugins/languages/vhdl.nix
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.types) enum bool listOf;
|
||||||
|
inherit (lib) genAttrs;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
|
cfg = config.vim.languages.vhdl;
|
||||||
|
|
||||||
|
defaultServers = ["vhdl-ls"];
|
||||||
|
servers = ["vhdl-ls"];
|
||||||
|
in {
|
||||||
|
options.vim.languages.vhdl = {
|
||||||
|
enable = mkEnableOption "VHDL language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "VHDL treesitter"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableTreesitter;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
||||||
|
};
|
||||||
|
package = mkGrammarOption pkgs "vhdl";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "VHDL LSP support"
|
||||||
|
// {
|
||||||
|
default = config.vim.lsp.enable;
|
||||||
|
defaultText = literalExpression "config.vim.lsp.enable";
|
||||||
|
};
|
||||||
|
servers = mkOption {
|
||||||
|
type = listOf (enum servers);
|
||||||
|
default = defaultServers;
|
||||||
|
description = "VHDL LSP server to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = ["vhdl"];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
./lua-language-server.nix
|
./lua-language-server.nix
|
||||||
./markdown-oxide.nix
|
./markdown-oxide.nix
|
||||||
./marksman.nix
|
./marksman.nix
|
||||||
|
./millet.nix
|
||||||
./neocmakelsp.nix
|
./neocmakelsp.nix
|
||||||
./nil.nix
|
./nil.nix
|
||||||
./nimlsp.nix
|
./nimlsp.nix
|
||||||
|
|
@ -73,6 +74,7 @@
|
||||||
./typescript-go.nix
|
./typescript-go.nix
|
||||||
./typescript-language-server.nix
|
./typescript-language-server.nix
|
||||||
./vala-language-server.nix
|
./vala-language-server.nix
|
||||||
|
./vhdl-ls.nix
|
||||||
./vscode-css-language-server.nix
|
./vscode-css-language-server.nix
|
||||||
./vscode-json-language-server.nix
|
./vscode-json-language-server.nix
|
||||||
./vtsls.nix
|
./vtsls.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"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
24
modules/plugins/lsp/presets/vhdl-ls.nix
Normal file
24
modules/plugins/lsp/presets/vhdl-ls.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.vhdl-ls;
|
||||||
|
in {
|
||||||
|
options.vim.lsp.presets.vhdl-ls = {
|
||||||
|
enable = mkLspPresetEnableOption "vhdl-ls" "VHDL" [];
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim.lsp.servers.vhdl-ls = {
|
||||||
|
enable = true;
|
||||||
|
cmd = [(getExe pkgs.vhdl-ls)];
|
||||||
|
root_markers = [".git" "vhdl_ls.toml"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -41,8 +41,12 @@ in {
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
List of treesitter grammars to install. For grammars to be installed properly,
|
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 must use grammars from one of those:
|
||||||
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
|
- `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
|
For languages already supported by nvf, you may use
|
||||||
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ in {
|
||||||
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
|
mapAttrsToList (name: value: "vim.g.${name} = ${toLuaObject value}") cfg.globals;
|
||||||
|
|
||||||
optionsScript =
|
optionsScript =
|
||||||
mapAttrsToList (name: value: "vim.o.${name} = ${toLuaObject value}") cfg.options;
|
mapAttrsToList (name: value: "vim.opt.${name} = ${toLuaObject value}") cfg.options;
|
||||||
|
|
||||||
extraPluginConfigs = resolveDag {
|
extraPluginConfigs = resolveDag {
|
||||||
name = "extra plugin configs";
|
name = "extra plugin configs";
|
||||||
|
|
|
||||||
|
|
@ -266,9 +266,9 @@ in {
|
||||||
after `basic` and before `pluginConfigs` DAG entries.
|
after `basic` and before `pluginConfigs` DAG entries.
|
||||||
|
|
||||||
::: {.note}
|
::: {.note}
|
||||||
`{foo = "bar";}` will set `vim.o.foo` to "bar", where the type of `bar` in the
|
`{foo = "bar";}` will set `vim.opt.foo` to "bar", where the type of
|
||||||
resulting Lua value will be inferred from the type of the value in the
|
`bar` in the resulting Lua value will be inferred from the type of the
|
||||||
`{name = value;}` pair passed to the option.
|
value in the `{name = value;}` pair passed to the option.
|
||||||
:::
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue