Since cbd1003d9d I'm able to add _some_
invalid config definitions to modules the tests are using and get no
build error.
For example `extraConfigLua = null;` should produce an invalid type
error, but doesn't.
One less visible change in that commit is the move away from using the
"standalone" wrapper (`makeNixvimWithModule`), which implicitly sets
`wrapRc = true`.
Adding back `wrapRc` to the tests seems to fix the issue, however this
makes me wonder if there's an underlying issue with wrapping/not-wrapping?
Perhaps we've simply uncovered a long-standing eval issue that is masked
over by using `wrapRc`?
Warnings and assertions defined as `config.warnings` and `config.assertions`
respectively will be checked as part of the test derivation, instead of
when evaluating the modules.
Adds new `checkWarnings` and `checkAssertions` test options (default true).
Introduces the `test.runNvim` module option.
Deprecates the historic `dontRun` argument passed to the test-derivation
helpers.
Soft-deprecates the `tests.dontRun` attr used in tests currently.
- Replace nullable lua option with a no-default option.
- Made it so the deprecated option is only declared when `lua = true` is passed.
- Replace `normalizeMappings` with a `removeDeprecatedMapAttrs` helper.
- Added warnings for all options that historically had `lua` support.
lib/extend-lib.nix returns a nixpkg's lib extended with our own
helpers.
This is exposed as `helpers.extendedLib`, but when evaluating our
modules it should be assigned to `specialArgs.lib`.
Outside of our modules you must still access our helpers via
`config.lib.nixvim` or `config.lib.nixvim.extendedLib`.
Within helpers' sub-sections, `lib` is the extended lib.
This commit adds support for byte compiling lua configuration files.
It's enabled by default (if byte compiling is enabled at all) and can be
disabled with `performance.byteCompileLua.configs` toggle.
To implement this feature `extraFiles.<name>.finalSource` internal
read-only option is introduced. `source` option cannot be used because
it's user configurable. In order to access the values of the
`performance.byteCompileLua` options, parent config is added to
specialArgs of extraFiles submodule. Then the usages of `source` option
changed to `finalSource` in all relevant places (filesPlugin and
wrappers).
Added more helpers for various cases of byte compiling:
* `byteCompileLuaFile` byte compiles lua file
* `byteCompileLuaHook` is a setup hook that byte compiles all lua files
* `byteCompileLuaDrv` overrides derivation by adding byteCompileLuaHook
to it
Added tests to validate that extraFiles specified by various methods are
handled correctly. Added a separate home-manager test, that is intended
to validate that extraFiles propagated to wrapper modules are correctly
byte compiled.
* add `performance.byteCompileLua.enable` toggle to enable or disable
all byte compiling features
* add `performance.byteCompileLua.initLua` toggle to enable or
disable byte compiling of init.lua
* add `writeByteCompiledLua` helper for saving byte compiled lua source
code to the nix store
* `nixvim-print-init` utility is always pointed to uncompiled init.lua
* add tests
Define `call = callPackageWith { inherit pkgs lib helpers; }`, which can
be used to automatically pass the correct args into helpers files.
`helpers` is passed in recursively.
Problem: Some modules are setting empty strings to extraConfig* options
with the intention to not generate any config. But empty
strings are also values, so they are still concatenated in the
final value of extraConfig* options. This results in a
multiple empty strings in extraConfigs.
Solution: Avoid using optionalString when setting values to extraConfig*
options. Use mkIf instead.
This commit also fixes mkIf condition in autocmd module.
`mkNeovimPlugin` is a special case. To avoid evaluating
caller's arguments mkMerge/optionalAttrs pattern is used
instead.
The motivation for this change was to avoid generating empty
config sections like
vim.cmd([[
]])
To make a config generation cleaner several helper functions introduced:
* `hasContent` have been moved to helpers
* `concatNonEmptyLines` joins strings (which has content) separated with
newlines
* `wrapVimscriptForLua` wraps a lua string for using in Vimscript, but
only if the string has content, otherwise empty string is returned
* `wrapLuaForVimscript` wraps Vimscript for using in lua, but only if
the string has content, otherwise empty string is returned
Added tests:
* testing that all possible config sections are present in the final
generated config
* testing that the config files generated by empty `files` definitions
don't have any content in it
Based on `types.coerceTo`, which is like `types.either` but coerces the
left-hand type into the right-hand type.
`transitionType` only shows the right-hand type in its description and
also prints a warning when the left-hand type is used.
Co-authored-by: Silvan Mosberger <contact@infinisil.com>
- The `setup` function name can be overridden with `setup`
(default ".setup")
- The entire `settings` option description can be overridden with
`settingsDescription`
- `luaName` and `setup` are used in the default description
No longer assume that string-type plugin defaults are already
pre-formatted.
Instead, pre-formatted values should be defined using
`literalExpression` or `literalMD`.