plugins/utils: normalize plugin defaults

This commit is contained in:
Matt Sturgeon 2024-06-11 16:54:57 +01:00
parent b10a391bd0
commit 6ab2a39e6a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
53 changed files with 1434 additions and 1221 deletions

View file

@ -43,17 +43,15 @@ helpers.neovim-plugin.mkNeovimPlugin config {
settingsOptions = with helpers.nixvimTypes; {
prompt_func_return_type =
helpers.defaultNullOpts.mkAttrsOf bool
''
{
go = false;
java = false;
cpp = false;
c = false;
h = false;
hpp = false;
cxx = false;
}
''
{
go = false;
java = false;
cpp = false;
c = false;
h = false;
hpp = false;
cxx = false;
}
''
For certain languages like Golang, types are required for functions that return an object(s).
Unfortunately, for some functions there is no way to automatically find their type. In those instances,
@ -74,17 +72,15 @@ helpers.neovim-plugin.mkNeovimPlugin config {
prompt_func_param_type =
helpers.defaultNullOpts.mkAttrsOf bool
''
{
go = false;
java = false;
cpp = false;
c = false;
h = false;
hpp = false;
cxx = false;
}
''
{
go = false;
java = false;
cpp = false;
c = false;
h = false;
hpp = false;
cxx = false;
}
''
For certain languages like Golang, types are required for functions parameters.
Unfortunately, for some parameters there is no way to automatically find their type. In those instances,
@ -102,7 +98,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
}
'';
printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) "{ }" ''
printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } ''
In any custom printf statement, it is possible to optionally add a **max of one `%s` pattern**, which is where the debug path will go.
For an example custom printf statement, go to [this folder][folder], select your language, and click on `multiple-statements/printf.config`.
@ -121,7 +117,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
[folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/printf
'';
print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) "{ }" ''
print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } ''
In any custom print var statement, it is possible to optionally add a **max of two `%s` patterns**, which is where the debug path and
the actual variable reference will go, respectively. To add a literal `"%s"` to the string, escape the sequence like this: `%%s`.
For an example custom print var statement, go to [this folder][folder], select your language, and view `multiple-statements/print_var.config`.
@ -141,7 +137,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
[folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/print_var
'';
extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str "{ }" ''
extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str { } ''
When performing an `extract_var` refactor operation, you can custom how the new variable would be declared by setting configuration
like the below example.