-
-
Notifications
You must be signed in to change notification settings - Fork 626
#1166 validate user's options #1177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the implementation :)
Got Edit: according to readme |
i think the ignore list might be incorrect ? |
filters = {
custom = { '.git', 'node_modules', '.cache', '.DS_Store' },
}, Nothing really fancy in there I think. |
not yours @gegoune , the one in the PR ^^ |
That is definitely not working correctly. It should go in However, reporting an itable index is also wrong and needs to be fixed. |
That can be fixed. @gegoune how is that message formatted? I've been testing with nvt-min and plain text formatting. Maybe share your config? |
@alex-courtis it's default config for rcarriga/nvim-notify. |
Hardened and rewrote:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice improvement :) thanks !
@gegoune does this work now for you as expected ? |
Yes, it does. Looks good now and detects incorrect keys, at least handful that I tried Thanks! |
@@ -324,6 +324,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS | |||
view = { | |||
width = 30, | |||
height = 30, | |||
hide_root_folder = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an extra hide_root_folder
in the above table. It doesn't appear to be used, so I deleted it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, it wasn't in the right place !
Thanks for that! Hopefully it will prevent configuration-issue issues. |
I set up width with function. Not working anymore? require("nvim-tree").setup({
view = {
width = function()
return math.floor(vim.o.columns * 0.225)
end,
}
}) Warning
|
Interesting use case: functions for configuration options is something I would never have considered. Alternatives:
I like flexibility; 2 is a good compromise. We would need to document that with warnings and a rule that bugs cannot be raised when such functions are used. @kyazdani42 ? Edit: I have implemented 3: #1195 It might be useful to allow functions as tables for, say, |
How about 'allow functions but require returned value of specific type and validate it'? |
That would be great, have you got a specific idea on how we would do this? The user could do anything in that function; I don't think we could validate it by executing it, as it may throw an exception when run at plugin startup. |
Ah, that's a good point. Can't really think of a solution here. |
there is only a function available for the tree width / height but the implementation for the validation is good enough :) |
Maybe provide an option like |
you can pass in '40%' and it will adapt to the number of columns. |
This reverts commit 5bbd3a0.
closes #1166
Quite easy: validate user's options against DEFAULT_OPTS.
@geoboom I would be very grateful if you can test, test, test.
Edit: apologies @geoboom I meant to ask @gegoune to test this one ;)