@@ -43,26 +43,59 @@ lib.nixvim.plugins.mkNeovimPlugin {
43
43
] "Log level." ;
44
44
} ;
45
45
46
- extraConfig = cfg : {
47
- warnings = lib . nixvim . mkWarnings "plugins.ltex-extra" {
48
- when = ! config . plugins . lsp . enable ;
49
- message = ''
50
- You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
51
- You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
46
+ extraConfig =
47
+ cfg :
48
+ let
49
+ inherit ( config . plugins . lsp . servers ) ltex ;
50
+ attachLua = ''
51
+ require("ltex_extra").setup( ${ lib . nixvim . toLuaObject cfg . settings } )
52
52
'' ;
53
- } ;
54
-
55
- plugins . lsp = {
56
- servers . ltex = {
57
- # Enable the ltex language server
58
- enable = true ;
53
+ in
54
+ {
55
+ warnings = lib . nixvim . mkWarnings "plugins.ltex-extra" [
56
+ {
57
+ when = ! config . plugins . lsp . enable ;
58
+ message = ''
59
+ You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
60
+ You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
61
+ '' ;
62
+ }
63
+ {
64
+ # TODO: Added 2025-03-30; remove after 25.05
65
+ # Warn if someone seem to have an externaly configured servers.ltex
66
+ when =
67
+ ltex . enable != true
68
+ && (
69
+ ltex . onAttach . function != attachLua
70
+ || ltex . onAttach . override != false
71
+ ||
72
+ [ ] != collect ( v : ! ( isAttrs v || v == null ) ) (
73
+ ltex
74
+ // {
75
+ extraSettings = null ;
76
+ package = null ;
77
+ onAttach = null ;
78
+ }
79
+ )
80
+ ) ;
81
+ message = ''
82
+ You seem to have configured `plugins.lsp.servers.ltex` for ltex-extra.
83
+ It now uses `plugins.lsp.servers.ltex_plus` by default,
84
+ either move the configuration or explicitly enable `ltex` with
85
+ `plugins.lsp.servers.ltex.enable = true`
86
+ '' ;
87
+ }
88
+ ] ;
59
89
60
- onAttach . function = ''
61
- require("ltex_extra").setup(${ lib . nixvim . toLuaObject cfg . settings } )
62
- '' ;
90
+ plugins . lsp = {
91
+ servers . ltex . onAttach . function = attachLua ;
92
+ servers . ltex_plus = {
93
+ # Enable ltex_plus if ltex is not already enabled
94
+ enable = mkIf ( ! ltex . enable ) true ;
95
+ onAttach . function = attachLua ;
96
+ } ;
63
97
} ;
64
98
} ;
65
- } ;
66
99
67
100
settingsExample = {
68
101
path = ".ltex" ;
0 commit comments