diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-11-04 19:00:12 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-04 05:00:12 -0800 |
commit | a27419f3fc540f66567f4559a796cd6758f1bb1f (patch) | |
tree | ff8d1f00c01bb391facba5d239a58eb5aa07eb44 /scripts/gen_eval_files.lua | |
parent | 04d178053fee7be92c8a7634a1acfe373c758638 (diff) | |
download | rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.tar.gz rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.tar.bz2 rneovim-a27419f3fc540f66567f4559a796cd6758f1bb1f.zip |
feat(options)!: disallow setting hidden options #28400
Problem:
There are three different ways of marking an option as hidden, `enable_if
= false`, `hidden = true` and `immutable = true`. These also have different
behaviors. Options hidden with `enable_if = false` can't have their value
fetched using Vim script or the API, but options hidden with `hidden = true` or
`immutable = true` can. On the other hand, options with `hidden = true` do not
error when trying to set their value, but options with `immutable = true` do.
Solution:
Remove `enable_if = false`, remove the `hidden` property for options, and use
`immutable = true` to mark an option as hidden instead. Also make hidden option
variable pointers always point to the default value, which allows fetching the
value of every hidden option using Vim script and the API. This does also mean
that trying to set a hidden option will now give an error instead of just being
ignored.
Diffstat (limited to 'scripts/gen_eval_files.lua')
-rwxr-xr-x | scripts/gen_eval_files.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/gen_eval_files.lua b/scripts/gen_eval_files.lua index 2928361695..edf95043c5 100755 --- a/scripts/gen_eval_files.lua +++ b/scripts/gen_eval_files.lua @@ -717,7 +717,9 @@ local function get_option_meta() local optinfo = vim.api.nvim_get_all_options_info() local ret = {} --- @type table<string,vim.option_meta> for _, o in ipairs(opts) do - if not o.immutable and not o.hidden and o.enable_if ~= false and o.desc then + local is_window_option = #o.scope == 1 and o.scope[1] == 'window' + local is_option_hidden = o.immutable and not o.varname and not is_window_option + if not is_option_hidden and o.desc then if o.full_name == 'cmdheight' then table.insert(o.scope, 'tab') end |