aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-03-25 03:14:00 +0600
committerLewis Russell <me@lewisr.dev>2024-03-26 20:56:42 +0000
commitde87197fdc3aa8123a060fc3a780e087c8e258ac (patch)
tree202d0097c36178fe6565781789667fe8390a6eba /src/nvim/generators
parentd3771e68a2a6be47a3ec158c9b0aff892a9038b9 (diff)
downloadrneovim-de87197fdc3aa8123a060fc3a780e087c8e258ac.tar.gz
rneovim-de87197fdc3aa8123a060fc3a780e087c8e258ac.tar.bz2
rneovim-de87197fdc3aa8123a060fc3a780e087c8e258ac.zip
refactor(options): make `immutable` and `hidden` options distinct
Problem: Currently, the `immutable` property of options can be applied for options that are hidden and options whose value simply can't be changed. Which is problematic when attempting to convert an option like `'maxcombine'` into an immutable option, because trying to `:set` an immutable option currently gives an error, which is only desired behavior for hidden options, not options that are actually immutable. Solution: Separate the `immutable` property into two distinct `hidden` and `immutable` properties. Change all options with the `immutable` property to use the `hidden` property instead. Also add `p_mco` as an `immutable` option, as its value cannot be changed, and the underlying variable is not used anywhere.
Diffstat (limited to 'src/nvim/generators')
-rw-r--r--src/nvim/generators/gen_options.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua
index 749844e658..c0c0d6e0b4 100644
--- a/src/nvim/generators/gen_options.lua
+++ b/src/nvim/generators/gen_options.lua
@@ -164,14 +164,19 @@ local function dump_option(i, o)
if o.enable_if then
w(get_cond(o.enable_if))
end
+
+ -- Options cannot be both hidden and immutable.
+ assert(not o.hidden or not o.immutable)
+
if o.varname then
w(' .var=&' .. o.varname)
- -- Immutable options can directly point to the default value.
- elseif o.immutable then
+ -- Hidden and immutable options can directly point to the default value.
+ elseif o.hidden or o.immutable then
w((' .var=&options[%u].def_val'):format(i - 1))
elseif #o.scope == 1 and o.scope[1] == 'window' then
w(' .var=VAR_WIN')
end
+ w(' .hidden=' .. (o.hidden and 'true' or 'false'))
w(' .immutable=' .. (o.immutable and 'true' or 'false'))
if #o.scope == 1 and o.scope[1] == 'global' then
w(' .indir=PV_NONE')