mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-27 21:41:29 +00:00
Compare commits
14 commits
a21e61da5e
...
4e647505d6
Author | SHA1 | Date | |
---|---|---|---|
4e647505d6 | |||
5c950f5f8c | |||
53207d2dcb | |||
62292777f1 | |||
94e6f49b78 | |||
8a0e8df411 | |||
42c5228dc1 | |||
![]() |
665feee445 | ||
![]() |
0aa557dac6 | ||
![]() |
5ab1af9285 | ||
![]() |
30a8a8fce0 | ||
![]() |
da86e554a6 | ||
![]() |
71e2ae1db4 | ||
![]() |
e80520ddf3 |
14 changed files with 376 additions and 56 deletions
|
@ -75,6 +75,7 @@ isMaximal: {
|
||||||
enable = isMaximal;
|
enable = isMaximal;
|
||||||
crates.enable = isMaximal;
|
crates.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
csharp.enable = isMaximal;
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals = {
|
visuals = {
|
||||||
|
|
|
@ -68,9 +68,19 @@ everyone.
|
||||||
As part of the autocompletion rewrite, modules that used to use a `type` option
|
As part of the autocompletion rewrite, modules that used to use a `type` option
|
||||||
have been replaced by per-plugin modules instead. Since both modules only had
|
have been replaced by per-plugin modules instead. Since both modules only had
|
||||||
one type, you can simply change
|
one type, you can simply change
|
||||||
|
|
||||||
- `vim.autocomplete.*` -> `vim.autocomplete.nvim-cmp.*`
|
- `vim.autocomplete.*` -> `vim.autocomplete.nvim-cmp.*`
|
||||||
- `vim.autopairs.enable` -> `vim.autopairs.nvim-autopairs.enable`
|
- `vim.autopairs.enable` -> `vim.autopairs.nvim-autopairs.enable`
|
||||||
|
|
||||||
|
### `nixpkgs-fmt` removed in favor of `nixfmt` {#sec-nixpkgs-fmt-deprecation}
|
||||||
|
|
||||||
|
`nixpkgs-fmt` has been archived for a while, and it's finally being removed in
|
||||||
|
favor of nixfmt (more information can be found
|
||||||
|
[here](https://github.com/nix-community/nixpkgs-fmt?tab=readme-ov-file#nixpkgs-fmt---nix-code-formatter-for-nixpkgs).
|
||||||
|
|
||||||
|
To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
|
||||||
|
`nixfmt`.
|
||||||
|
|
||||||
## Changelog {#sec-release-0.7-changelog}
|
## Changelog {#sec-release-0.7-changelog}
|
||||||
|
|
||||||
[ItsSorae](https://github.com/ItsSorae):
|
[ItsSorae](https://github.com/ItsSorae):
|
||||||
|
@ -171,6 +181,7 @@ one type, you can simply change
|
||||||
default.
|
default.
|
||||||
|
|
||||||
- Refactor of `nvim-cmp` and completion related modules
|
- Refactor of `nvim-cmp` and completion related modules
|
||||||
|
|
||||||
- Remove `autocomplete.type` in favor of per-plugin enable options such as
|
- Remove `autocomplete.type` in favor of per-plugin enable options such as
|
||||||
[](#opt-vim.autocomplete.nvim-cmp.enable).
|
[](#opt-vim.autocomplete.nvim-cmp.enable).
|
||||||
- Deprecate legacy Vimsnip in favor of Luasnip, and integrate
|
- Deprecate legacy Vimsnip in favor of Luasnip, and integrate
|
||||||
|
@ -179,6 +190,9 @@ one type, you can simply change
|
||||||
- Add sorting function options for completion sources under
|
- Add sorting function options for completion sources under
|
||||||
[](#opt-vim.autocomplete.nvim-cmp.setupOpts.sorting.comparators)
|
[](#opt-vim.autocomplete.nvim-cmp.setupOpts.sorting.comparators)
|
||||||
|
|
||||||
|
- Add C# support under `vim.languages.csharp`, with support for both
|
||||||
|
omnisharp-roslyn and csharp-language-server.
|
||||||
|
|
||||||
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
||||||
|
|
||||||
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
||||||
|
@ -256,9 +270,13 @@ one type, you can simply change
|
||||||
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim)
|
||||||
|
|
||||||
- Update `lualine.nvim` input and add missing themes:
|
- Update `lualine.nvim` input and add missing themes:
|
||||||
|
|
||||||
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
|
- Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`,
|
||||||
`powerline_dark` and `solarized_light` themes.
|
`powerline_dark` and `solarized_light` themes.
|
||||||
|
|
||||||
|
- Add [](#opt-vim.spellcheck.extraSpellWords) to allow adding arbitrary
|
||||||
|
spellfiles to Neovim's runtime with ease.
|
||||||
|
|
||||||
[ppenguin](https://github.com/ppenguin):
|
[ppenguin](https://github.com/ppenguin):
|
||||||
|
|
||||||
- Telescope:
|
- Telescope:
|
||||||
|
@ -270,6 +288,7 @@ one type, you can simply change
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
ccc
|
ccc
|
||||||
|
- Fixed typo in Otter's setupOpts
|
||||||
- Add Neorg support under `vim.notes.neorg`
|
- Add Neorg support under `vim.notes.neorg`
|
||||||
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||||
`vim.languages.kotlin`
|
`vim.languages.kotlin`
|
||||||
|
@ -286,3 +305,11 @@ one type, you can simply change
|
||||||
- Add LSP support for Scala via
|
- Add LSP support for Scala via
|
||||||
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
||||||
|
|
||||||
|
[nezia1](https://github.com/nezia1):
|
||||||
|
|
||||||
|
- Add [biome](https://github.com/biomejs/biome) support for Typescript, CSS and
|
||||||
|
Svelte. Enable them via [](#opt-vim.languages.ts.format.type),
|
||||||
|
[](#opt-vim.languages.css.format.type) and
|
||||||
|
[](#opt-vim.languages.svelte.format.type) respectively.
|
||||||
|
- Replace [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) with
|
||||||
|
[nixfmt](https://github.com/NixOS/nixfmt) (nixfmt-rfc-style).
|
||||||
|
|
34
flake.lock
generated
34
flake.lock
generated
|
@ -460,6 +460,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-csharpls-extended": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728438370,
|
||||||
|
"narHash": "sha256-sOLPV5IhOvQ0+u7CDAfG3X0ZbRCicz18QyYXQ0dxpwQ=",
|
||||||
|
"owner": "Decodetalkers",
|
||||||
|
"repo": "csharpls-extended-lsp.nvim",
|
||||||
|
"rev": "b647e1bd1f9c0410f5ef4a1517a331cbac322d9a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Decodetalkers",
|
||||||
|
"repo": "csharpls-extended-lsp.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-dashboard-nvim": {
|
"plugin-dashboard-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1453,6 +1469,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plugin-omnisharp-extended": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1719701797,
|
||||||
|
"narHash": "sha256-P1ZCaW8w+e3H3oBhbEjDc7vuR+XuxJmb/7IbPL3KWi4=",
|
||||||
|
"owner": "Hoffs",
|
||||||
|
"repo": "omnisharp-extended-lsp.nvim",
|
||||||
|
"rev": "aad7bf06b4ca0de816b919d475a75b30f5f62b61",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Hoffs",
|
||||||
|
"repo": "omnisharp-extended-lsp.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"plugin-onedark": {
|
"plugin-onedark": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1932,6 +1964,7 @@
|
||||||
"plugin-copilot-cmp": "plugin-copilot-cmp",
|
"plugin-copilot-cmp": "plugin-copilot-cmp",
|
||||||
"plugin-copilot-lua": "plugin-copilot-lua",
|
"plugin-copilot-lua": "plugin-copilot-lua",
|
||||||
"plugin-crates-nvim": "plugin-crates-nvim",
|
"plugin-crates-nvim": "plugin-crates-nvim",
|
||||||
|
"plugin-csharpls-extended": "plugin-csharpls-extended",
|
||||||
"plugin-dashboard-nvim": "plugin-dashboard-nvim",
|
"plugin-dashboard-nvim": "plugin-dashboard-nvim",
|
||||||
"plugin-diffview-nvim": "plugin-diffview-nvim",
|
"plugin-diffview-nvim": "plugin-diffview-nvim",
|
||||||
"plugin-dracula": "plugin-dracula",
|
"plugin-dracula": "plugin-dracula",
|
||||||
|
@ -1994,6 +2027,7 @@
|
||||||
"plugin-nvim-ts-autotag": "plugin-nvim-ts-autotag",
|
"plugin-nvim-ts-autotag": "plugin-nvim-ts-autotag",
|
||||||
"plugin-nvim-web-devicons": "plugin-nvim-web-devicons",
|
"plugin-nvim-web-devicons": "plugin-nvim-web-devicons",
|
||||||
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
"plugin-obsidian-nvim": "plugin-obsidian-nvim",
|
||||||
|
"plugin-omnisharp-extended": "plugin-omnisharp-extended",
|
||||||
"plugin-onedark": "plugin-onedark",
|
"plugin-onedark": "plugin-onedark",
|
||||||
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
||||||
"plugin-otter-nvim": "plugin-otter-nvim",
|
"plugin-otter-nvim": "plugin-otter-nvim",
|
||||||
|
|
10
flake.nix
10
flake.nix
|
@ -211,6 +211,16 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-omnisharp-extended = {
|
||||||
|
url = "github:Hoffs/omnisharp-extended-lsp.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin-csharpls-extended = {
|
||||||
|
url = "github:Decodetalkers/csharpls-extended-lsp.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
# Copying/Registers
|
# Copying/Registers
|
||||||
plugin-registers = {
|
plugin-registers = {
|
||||||
url = "github:tversteeg/registers.nvim";
|
url = "github:tversteeg/registers.nvim";
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf mkRenamedOptionModule;
|
inherit (lib.modules) mkIf mkRenamedOptionModule;
|
||||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.types) listOf str;
|
inherit (lib.strings) concatLines;
|
||||||
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
|
inherit (lib.types) listOf str attrsOf;
|
||||||
inherit (lib.nvim.lua) listToLuaTable;
|
inherit (lib.nvim.lua) listToLuaTable;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
|
@ -24,10 +27,43 @@ in {
|
||||||
description = ''
|
description = ''
|
||||||
A list of languages that should be used for spellchecking.
|
A list of languages that should be used for spellchecking.
|
||||||
|
|
||||||
To add your own language files, you may place your `spell`
|
To add your own language files, you may place your `spell` directory in either
|
||||||
directory in either `~/.config/nvim` or the
|
{file}`$XDG_CONFIG_HOME/nvf` or in a path that is included in the
|
||||||
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
|
[additionalRuntimePaths](#opt-vim.additionalRuntimePaths) list provided by nvf.
|
||||||
directory provided by **nvf**.
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraSpellWords = mkOption {
|
||||||
|
type = attrsOf (listOf str);
|
||||||
|
default = {};
|
||||||
|
example = literalExpression ''{"en.utf-8" = ["nvf" "word_you_want_to_add"];}'';
|
||||||
|
description = ''
|
||||||
|
Additional words to be used for spellchecking. The names of each key will be
|
||||||
|
used as the language code for the spell file. For example
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"en.utf-8" = [ ... ];
|
||||||
|
```
|
||||||
|
|
||||||
|
will result in `en.utf-8.add.spl` being added to Neovim's runtime in the
|
||||||
|
{file}`spell` directory.
|
||||||
|
|
||||||
|
::: {.warning}
|
||||||
|
The attribute keys must be in `"<name>.<encoding>"` format for Neovim to
|
||||||
|
compile your spellfiles without mangling the resulting file names. Please
|
||||||
|
make sure that you enter the correct value, as nvf does not do any kind of
|
||||||
|
internal checking. Please see {command}`:help mkspell` for more details.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# "en" is the name, and "utf-8" is the encoding. For most use cases, utf-8
|
||||||
|
# will be enough, however, you may change it to any encoding format Neovim
|
||||||
|
# accepts, e.g., utf-16.
|
||||||
|
"en.utf-8" = ["nvf" "word_you_want_to_add"];
|
||||||
|
=> $out/spell/en-utf-8.add.spl
|
||||||
|
```
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,8 +74,10 @@ in {
|
||||||
description = ''
|
description = ''
|
||||||
A list of filetypes for which spellchecking will be disabled.
|
A list of filetypes for which spellchecking will be disabled.
|
||||||
|
|
||||||
You may use `echo &filetype` in Neovim to find out the
|
::: {.tip}
|
||||||
|
You may use {command}`:echo &filetype` in Neovim to find out the
|
||||||
filetype for a specific buffer.
|
filetype for a specific buffer.
|
||||||
|
:::
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,18 +96,53 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.luaConfigRC.spellcheck = entryAfter ["basic"] ''
|
vim = {
|
||||||
vim.opt.spell = true
|
additionalRuntimePaths = let
|
||||||
vim.opt.spelllang = ${listToLuaTable cfg.languages}
|
spellfilesJoined = pkgs.symlinkJoin {
|
||||||
|
name = "nvf-spellfiles-joined";
|
||||||
|
paths = mapAttrsToList (name: value: pkgs.writeTextDir "spell/${name}.add" (concatLines value)) cfg.extraSpellWords;
|
||||||
|
postBuild = ''
|
||||||
|
echo "Spellfiles joined"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
-- Disable spellchecking for certain filetypes
|
compileJoinedSpellfiles =
|
||||||
-- as configured by `vim.spellcheck.ignoredFiletypes`
|
pkgs.runCommandLocal "nvf-compile-spellfiles" {
|
||||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
# Use the same version of Neovim as the user's configuration
|
||||||
pattern = ${listToLuaTable cfg.ignoredFiletypes},
|
nativeBuildInputs = [config.vim.package];
|
||||||
callback = function()
|
} ''
|
||||||
vim.opt_local.spell = false
|
mkdir -p "$out/spell"
|
||||||
end,
|
|
||||||
})
|
spellfilesJoined=$(find -L "${spellfilesJoined}/spell" -type f)
|
||||||
'';
|
for spellfile in $spellfilesJoined; do
|
||||||
|
# Hacky way to ensure that the mangled extensions are omitted from the
|
||||||
|
# joined spellfiles. E.g.
|
||||||
|
local name=$(basename "$spellfile" ".add")
|
||||||
|
echo "Compiling spellfile: $spellfile"
|
||||||
|
nvim --headless --clean \
|
||||||
|
--cmd "mkspell $out/spell/$name.add.spl $spellfile" -Es -n
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
mkIf (cfg.extraSpellWords != {}) [
|
||||||
|
# If .outPath is missing, additionalRuntimePaths receives the *function*
|
||||||
|
# instead of a path, causing errors.
|
||||||
|
compileJoinedSpellfiles.outPath
|
||||||
|
];
|
||||||
|
|
||||||
|
luaConfigRC.spellcheck = entryAfter ["basic"] ''
|
||||||
|
vim.opt.spell = true
|
||||||
|
vim.opt.spelllang = ${listToLuaTable cfg.languages}
|
||||||
|
|
||||||
|
-- Disable spellchecking for certain filetypes
|
||||||
|
-- as configured by `vim.spellcheck.ignoredFiletypes`
|
||||||
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
pattern = ${listToLuaTable cfg.ignoredFiletypes},
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.spell = false
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
122
modules/plugins/languages/csharp.nix
Normal file
122
modules/plugins/languages/csharp.nix
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.types) either listOf package str enum;
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.lists) isList;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
|
||||||
|
lspKeyConfig = config.vim.lsp.mappings;
|
||||||
|
lspKeyOptions = options.vim.lsp.mappings;
|
||||||
|
mkLspBinding = optionName: action: let
|
||||||
|
key = lspKeyConfig.${optionName};
|
||||||
|
desc = lspKeyOptions.${optionName}.description;
|
||||||
|
in
|
||||||
|
optionalString (key != null) "vim.keymap.set('n', '${key}', ${action}, {buffer=bufnr, noremap=true, silent=true, desc='${desc}'})";
|
||||||
|
|
||||||
|
# Omnisharp doesn't have colors in popup docs for some reason, and I've also
|
||||||
|
# seen mentions of it being way slower, so until someone finds missing
|
||||||
|
# functionality, this will be the default.
|
||||||
|
defaultServer = "csharp_ls";
|
||||||
|
servers = {
|
||||||
|
omnisharp = {
|
||||||
|
package = pkgs.omnisharp-roslyn;
|
||||||
|
internalFormatter = true;
|
||||||
|
lspConfig = ''
|
||||||
|
lspconfig.omnisharp.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
default_on_attach(client, bufnr)
|
||||||
|
|
||||||
|
local oe = require("omnisharp_extended")
|
||||||
|
${mkLspBinding "goToDefinition" "oe.lsp_definition"}
|
||||||
|
${mkLspBinding "goToType" "oe.lsp_type_definition"}
|
||||||
|
${mkLspBinding "listReferences" "oe.lsp_references"}
|
||||||
|
${mkLspBinding "listImplementations" "oe.lsp_implementation"}
|
||||||
|
end,
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else "{'${cfg.lsp.package}/bin/OmniSharp'}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
csharp_ls = {
|
||||||
|
package = pkgs.csharp-ls;
|
||||||
|
internalFormatter = true;
|
||||||
|
lspConfig = ''
|
||||||
|
local extended_handler = require("csharpls_extended").handler
|
||||||
|
|
||||||
|
lspconfig.csharp_ls.setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = default_on_attach,
|
||||||
|
handlers = {
|
||||||
|
["textDocument/definition"] = extended_handler,
|
||||||
|
["textDocument/typeDefinition"] = extended_handler
|
||||||
|
},
|
||||||
|
cmd = ${
|
||||||
|
if isList cfg.lsp.package
|
||||||
|
then expToLua cfg.lsp.package
|
||||||
|
else "{'${cfg.lsp.package}/bin/csharp-ls'}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraServerPlugins = {
|
||||||
|
omnisharp = ["omnisharp-extended"];
|
||||||
|
csharp_ls = ["csharpls-extended"];
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg = config.vim.languages.csharp;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
vim.languages.csharp = {
|
||||||
|
enable = mkEnableOption "C# language support";
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = mkEnableOption "C# treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||||
|
package = mkGrammarOption pkgs "c-sharp";
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = mkEnableOption "C# LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
|
server = mkOption {
|
||||||
|
description = "C# LSP server to use";
|
||||||
|
type = enum (attrNames servers);
|
||||||
|
default = defaultServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
description = "C# LSP server package, or the command to run as a list of strings";
|
||||||
|
type = either package (listOf str);
|
||||||
|
default = servers.${cfg.lsp.server}.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf cfg.treesitter.enable {
|
||||||
|
vim.treesitter.enable = true;
|
||||||
|
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.lsp.enable {
|
||||||
|
vim.startPlugins = extraServerPlugins.${cfg.lsp.server} or [];
|
||||||
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
vim.lsp.lspconfig.sources.csharp-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
}
|
|
@ -63,6 +63,18 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
biome = {
|
||||||
|
package = pkgs.biome;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.biome.with({
|
||||||
|
command = "${cfg.format.package}/bin/biome",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.css = {
|
options.vim.languages.css = {
|
||||||
|
|
|
@ -28,6 +28,7 @@ in {
|
||||||
./ts.nix
|
./ts.nix
|
||||||
./typst.nix
|
./typst.nix
|
||||||
./zig.nix
|
./zig.nix
|
||||||
|
./csharp.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.languages = {
|
options.vim.languages = {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.nvim.languages) diagnosticsToLua;
|
inherit (lib.nvim.languages) diagnosticsToLua;
|
||||||
inherit (lib.types) package;
|
inherit (lib.types) either package listOf str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
inherit (lib.nvim.lua) expToLua;
|
inherit (lib.nvim.lua) expToLua;
|
||||||
|
@ -43,17 +43,17 @@ in {
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
description = "kotlin_language_server package with Kotlin runtime";
|
description = "kotlin_language_server package with Kotlin runtime";
|
||||||
type = package;
|
type = either package (listOf str);
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
pkgs.symlinkJoin {
|
pkgs.symlinkJoin {
|
||||||
name = "kotlin-language-server-wrapped";
|
name = "kotlin-language-server-wrapped";
|
||||||
paths = [pkgs.kotlin-language-server];
|
paths = [pkgs.kotlin-language-server];
|
||||||
nativeBuildInputs = [pkgs.makeWrapper];
|
nativeBuildInputs = [pkgs.makeBinaryWrapper];
|
||||||
postBuild = '''
|
postBuild = '''
|
||||||
wrapProgram $out/bin/kotlin-language-server \
|
wrapProgram $out/bin/kotlin-language-server \
|
||||||
--prefix PATH : ''${pkgs.kotlin}/bin
|
--prefix PATH : ''${pkgs.kotlin}/bin
|
||||||
''';
|
''';
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
default = pkgs.kotlin-language-server;
|
default = pkgs.kotlin-language-server;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
|
inherit (lib) concatStringsSep;
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.lists) isList;
|
inherit (lib.lists) isList;
|
||||||
|
@ -62,10 +63,10 @@
|
||||||
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
|
command = {"${cfg.format.package}/bin/alejandra", "--quiet"},
|
||||||
},
|
},
|
||||||
''}
|
''}
|
||||||
${optionalString (cfg.format.type == "nixpkgs-fmt")
|
${optionalString (cfg.format.type == "nixfmt")
|
||||||
''
|
''
|
||||||
formatting = {
|
formatting = {
|
||||||
command = {"${cfg.format.package}/bin/nixpkgs-fmt"},
|
command = {"${cfg.format.package}/bin/nixfmt"},
|
||||||
},
|
},
|
||||||
''}
|
''}
|
||||||
},
|
},
|
||||||
|
@ -90,10 +91,19 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs-fmt = {
|
nixfmt = {
|
||||||
package = pkgs.nixpkgs-fmt;
|
package = pkgs.nixfmt-rfc-style;
|
||||||
# Never need to use null-ls for nixpkgs-fmt
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.nixfmt.with({
|
||||||
|
command = "${cfg.format.package}/bin/nixfmt"
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgs-fmt = null; # removed
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||||
|
@ -135,7 +145,7 @@ in {
|
||||||
enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
|
enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
description = "Nix LSP server to use";
|
description = "Nix LSP server to use";
|
||||||
type = str;
|
type = enum (attrNames servers);
|
||||||
default = defaultServer;
|
default = defaultServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -175,6 +185,12 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.format.type != "nixpkgs-fmt";
|
||||||
|
message = "nixpkgs-fmt has been archived upstream. Please use one of the following instead: ${concatStringsSep ", " (attrNames formats)}";
|
||||||
|
}
|
||||||
|
];
|
||||||
vim.pluginRC.nix = ''
|
vim.pluginRC.nix = ''
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "nix",
|
pattern = "nix",
|
||||||
|
|
|
@ -48,6 +48,18 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
biome = {
|
||||||
|
package = pkgs.biome;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.biome.with({
|
||||||
|
command = "${cfg.format.package}/bin/biome",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
|
|
|
@ -95,6 +95,18 @@
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
biome = {
|
||||||
|
package = pkgs.biome;
|
||||||
|
nullConfig = ''
|
||||||
|
table.insert(
|
||||||
|
ls_sources,
|
||||||
|
null_ls.builtins.formatting.biome.with({
|
||||||
|
command = "${cfg.format.package}/bin/biome",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: specify packages
|
# TODO: specify packages
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||||
mkBinding = binding: action:
|
mkBinding = binding: action:
|
||||||
if binding.value != null
|
if binding.value != null
|
||||||
then "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})"
|
then "vim.keymap.set('n', '${binding.value}', ${action}, {buffer=bufnr, noremap=true, silent=true, desc='${binding.description}'})"
|
||||||
else "";
|
else "";
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -31,26 +31,26 @@ in {
|
||||||
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
vim.g.formatsave = ${boolToString cfg.formatOnSave};
|
||||||
|
|
||||||
local attach_keymaps = function(client, bufnr)
|
local attach_keymaps = function(client, bufnr)
|
||||||
${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration()"}
|
${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration"}
|
||||||
${mkBinding mappings.goToDefinition "vim.lsp.buf.definition()"}
|
${mkBinding mappings.goToDefinition "vim.lsp.buf.definition"}
|
||||||
${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"}
|
${mkBinding mappings.goToType "vim.lsp.buf.type_definition"}
|
||||||
${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"}
|
${mkBinding mappings.listImplementations "vim.lsp.buf.implementation"}
|
||||||
${mkBinding mappings.listReferences "vim.lsp.buf.references()"}
|
${mkBinding mappings.listReferences "vim.lsp.buf.references"}
|
||||||
${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next()"}
|
${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next"}
|
||||||
${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev()"}
|
${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev"}
|
||||||
${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float()"}
|
${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float"}
|
||||||
${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight()"}
|
${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight"}
|
||||||
${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol()"}
|
${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol"}
|
||||||
${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder()"}
|
${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder"}
|
||||||
${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder()"}
|
${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder"}
|
||||||
${mkBinding mappings.listWorkspaceFolders "print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"}
|
${mkBinding mappings.listWorkspaceFolders "function() vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders())) end"}
|
||||||
${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol()"}
|
${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol"}
|
||||||
${mkBinding mappings.hover "vim.lsp.buf.hover()"}
|
${mkBinding mappings.hover "vim.lsp.buf.hover"}
|
||||||
${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help()"}
|
${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help"}
|
||||||
${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"}
|
${mkBinding mappings.renameSymbol "vim.lsp.buf.rename"}
|
||||||
${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"}
|
${mkBinding mappings.codeAction "vim.lsp.buf.code_action"}
|
||||||
${mkBinding mappings.format "vim.lsp.buf.format()"}
|
${mkBinding mappings.format "vim.lsp.buf.format"}
|
||||||
${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"}
|
${mkBinding mappings.toggleFormatOnSave "function() vim.b.disableFormatSave = not vim.b.disableFormatSave end"}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Enable formatting
|
-- Enable formatting
|
||||||
|
|
|
@ -32,7 +32,7 @@ in {
|
||||||
|
|
||||||
pluginRC.otter-nvim = entryAnywhere ''
|
pluginRC.otter-nvim = entryAnywhere ''
|
||||||
-- Enable otter diagnostics viewer
|
-- Enable otter diagnostics viewer
|
||||||
require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}})
|
require("otter").setup(${toLuaObject cfg.otter-nvim.setupOpts})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue