@@ -43,26 +43,60 @@ 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
68
+ && (
69
+ ltex . onAttach . function != attachLua
70
+ || ltex . onAttach . override != false
71
+ ||
72
+ [ ] != collect ( v : ! ( isAttrs v || v == null ) ) (
73
+ # Remove options that wouldn't be null in an empty ltex config
74
+ removeAttrs ltex [
75
+ "extraSettings"
76
+ "package"
77
+ "onAttach"
78
+ "enable"
79
+ ]
80
+ )
81
+ ) ;
82
+ message = ''
83
+ You seem to have configured `plugins.lsp.servers.ltex` for ltex-extra.
84
+ It now uses `plugins.lsp.servers.ltex_plus` by default,
85
+ either move the configuration or explicitly enable `ltex` with
86
+ `plugins.lsp.servers.ltex.enable = true`
87
+ '' ;
88
+ }
89
+ ] ;
59
90
60
- onAttach . function = ''
61
- require("ltex_extra").setup(${ lib . nixvim . toLuaObject cfg . settings } )
62
- '' ;
91
+ plugins . lsp = {
92
+ servers . ltex . onAttach . function = attachLua ;
93
+ servers . ltex_plus = {
94
+ # Enable ltex_plus if ltex is not already enabled
95
+ enable = mkIf ( ! ltex . enable ) true ;
96
+ onAttach . function = attachLua ;
97
+ } ;
63
98
} ;
64
99
} ;
65
- } ;
66
100
67
101
settingsExample = {
68
102
path = ".ltex" ;
0 commit comments