mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
Merge d7048c8661
into c6051305e5
This commit is contained in:
commit
98cad2c6e8
4 changed files with 66 additions and 17 deletions
|
@ -467,7 +467,7 @@ in
|
||||||
{
|
{
|
||||||
enable = mkOverride 1490 true;
|
enable = mkOverride 1490 true;
|
||||||
};
|
};
|
||||||
warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" {
|
warnings = lib.nixvim.mkWarnings "plugins.lspsaga" {
|
||||||
# https://nvimdev.github.io/lspsaga/implement/#default-options
|
# https://nvimdev.github.io/lspsaga/implement/#default-options
|
||||||
when = (cfg.implement.enable == true) && (cfg.symbolInWinbar.enable == false);
|
when = (cfg.implement.enable == true) && (cfg.symbolInWinbar.enable == false);
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
config,
|
config,
|
||||||
|
options,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
|
let
|
||||||
|
lspCfg = config.plugins.lsp;
|
||||||
|
in
|
||||||
lib.nixvim.plugins.mkNeovimPlugin {
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
name = "ltex-extra";
|
name = "ltex-extra";
|
||||||
packPathName = "ltex_extra.nvim";
|
packPathName = "ltex_extra.nvim";
|
||||||
|
@ -12,6 +16,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
|
|
||||||
maintainers = [ maintainers.loicreynier ];
|
maintainers = [ maintainers.loicreynier ];
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
This plugin works with both the ltex or ltex_plus language servers and will enable ltex_plus if neither are.
|
||||||
|
'';
|
||||||
|
|
||||||
callSetup = false;
|
callSetup = false;
|
||||||
|
|
||||||
settingsOptions = {
|
settingsOptions = {
|
||||||
|
@ -44,22 +52,63 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" {
|
warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" [
|
||||||
when = !config.plugins.lsp.enable;
|
{
|
||||||
|
when = !lspCfg.enable;
|
||||||
message = ''
|
message = ''
|
||||||
You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
|
You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
|
||||||
You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
|
You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
|
||||||
'';
|
'';
|
||||||
|
}
|
||||||
|
(
|
||||||
|
let
|
||||||
|
expectedDefs = map toString [
|
||||||
|
./.
|
||||||
|
../../lsp/language-servers
|
||||||
|
];
|
||||||
|
isExternal = d: !elem d.file expectedDefs;
|
||||||
|
anyExternal =
|
||||||
|
acc: name: v:
|
||||||
|
let
|
||||||
|
e = findFirst isExternal null v.definitionsWithLocations;
|
||||||
|
in
|
||||||
|
if acc != null then
|
||||||
|
acc
|
||||||
|
else if e == null then
|
||||||
|
null
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inherit name;
|
||||||
|
inherit (e) file;
|
||||||
};
|
};
|
||||||
|
external = foldlAttrs anyExternal null options.plugins.lsp.servers.ltex;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# TODO: Added 2025-03-30; remove after 25.05
|
||||||
|
# Warn if servers.ltex seems to be configured outside of ltex-extra
|
||||||
|
when = !lspCfg.servers.ltex.enable && external != null;
|
||||||
|
message = ''
|
||||||
|
in ${external.file}
|
||||||
|
You seem to have configured `plugins.lsp.servers.ltex.${external.name}` for `ltex-extra`.
|
||||||
|
It now uses `plugins.lsp.servers.ltex_plus` by default,
|
||||||
|
either move the configuration or explicitly enable `ltex` with `plugins.lsp.servers.ltex.enable = true`
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
plugins.lsp = {
|
plugins.lsp =
|
||||||
servers.ltex = {
|
let
|
||||||
# Enable the ltex language server
|
attachLua = ''
|
||||||
enable = true;
|
|
||||||
|
|
||||||
onAttach.function = ''
|
|
||||||
require("ltex_extra").setup(${lib.nixvim.toLuaObject cfg.settings})
|
require("ltex_extra").setup(${lib.nixvim.toLuaObject cfg.settings})
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
servers.ltex.onAttach.function = attachLua;
|
||||||
|
servers.ltex_plus = {
|
||||||
|
# Enable ltex_plus if ltex is not already enabled
|
||||||
|
enable = mkIf (!lspCfg.servers.ltex.enable) (mkDefault true);
|
||||||
|
onAttach.function = attachLua;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -249,7 +249,7 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
fields = defaultNullOpts.mkAttrsOf' {
|
bibtex.fields = defaultNullOpts.mkAttrsOf' {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
pluginDefault = { };
|
pluginDefault = { };
|
||||||
example = {
|
example = {
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
"laravel_ls"
|
"laravel_ls"
|
||||||
"lean3ls"
|
"lean3ls"
|
||||||
"lelwel_ls"
|
"lelwel_ls"
|
||||||
"ltex_plus"
|
|
||||||
"lwc_ls"
|
"lwc_ls"
|
||||||
"m68k"
|
"m68k"
|
||||||
"marko-js"
|
"marko-js"
|
||||||
|
@ -281,6 +280,7 @@
|
||||||
lemminx = "lemminx";
|
lemminx = "lemminx";
|
||||||
lsp_ai = "lsp-ai";
|
lsp_ai = "lsp-ai";
|
||||||
ltex = "ltex-ls";
|
ltex = "ltex-ls";
|
||||||
|
ltex_plus = "ltex-ls-plus";
|
||||||
lua_ls = "lua-language-server";
|
lua_ls = "lua-language-server";
|
||||||
luau_lsp = "luau-lsp";
|
luau_lsp = "luau-lsp";
|
||||||
markdown_oxide = "markdown-oxide";
|
markdown_oxide = "markdown-oxide";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue