File tree Expand file tree Collapse file tree 1 file changed +34
-4
lines changed Expand file tree Collapse file tree 1 file changed +34
-4
lines changed Original file line number Diff line number Diff line change 1818 options . plugins . none-ls . sources . ${ sourceType } . ${ sourceName } =
1919 {
2020 enable = lib . mkEnableOption "the ${ sourceName } ${ sourceType } source for none-ls" ;
21- withArgs = helpers . mkNullOrOption helpers . nixvimTypes . strLua ''
22- Raw Lua code passed as an argument to the source's `with` method.
23- '' ;
21+ # Support strLua for compatibility with the old withArgs option
22+ settings = helpers . defaultNullOpts . mkStrLuaOr' {
23+ type = with lib . types ; attrsOf anything ;
24+ description = ''
25+ Options provided to the `require('null-ls').builtins.${ sourceType } .${ sourceName } .with` function.
26+
27+ See upstream's [`BUILTIN_CONFIG`] documentation.
28+
29+ [`BUILTIN_CONFIG`]: https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md
30+ '' ;
31+ example = {
32+ extra_filetypes = [ "toml" ] ;
33+ disabled_filetypes = [ "lua" ] ;
34+ extra_args = [
35+ "-i"
36+ "2"
37+ "-ci"
38+ ] ;
39+ } ;
40+ } ;
2441 }
2542 # Only declare a package option if a package is required
2643 // lib . optionalAttrs ( packaged ? ${ sourceName } ) {
4259 ) ;
4360 } ;
4461
62+ # TODO: Added 2024-07-16; remove after 24.11
63+ imports =
64+ let
65+ basePath = [
66+ "plugins"
67+ "none-ls"
68+ "sources"
69+ sourceType
70+ sourceName
71+ ] ;
72+ in
73+ [ ( lib . mkRenamedOptionModule ( basePath ++ [ "withArgs" ] ) ( basePath ++ [ "settings" ] ) ) ] ;
74+
4575 config = lib . mkIf ( cfg . enable && cfg' . enable ) {
4676 plugins . none-ls . settings . sources = lib . mkDefault [
4777 (
4878 "require('null-ls').builtins.${ sourceType } .${ sourceName } "
49- + lib . optionalString ( cfg' . withArgs != null ) ".with(${ cfg' . withArgs } )"
79+ + lib . optionalString ( cfg' . settings != null ) ".with(${ helpers . toLuaObject cfg' . settings } )"
5080 )
5181 ] ;
5282
You can’t perform that action at this time.
0 commit comments