diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-11-17 02:56:16 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-16 12:56:16 -0800 |
commit | 29ded889579a9d590e8ea885a9a402ff4bae87be (patch) | |
tree | 476bc3746cfac48f141e5ab0aaf562480502fad2 /runtime/lua/vim/_meta/api.lua | |
parent | be8648f345aed5e403251990721918c8302be760 (diff) | |
download | rneovim-29ded889579a9d590e8ea885a9a402ff4bae87be.tar.gz rneovim-29ded889579a9d590e8ea885a9a402ff4bae87be.tar.bz2 rneovim-29ded889579a9d590e8ea885a9a402ff4bae87be.zip |
refactor(options): remove `.indir`, redesign option scopes #31066
Problem:
The way option scopes currently work is inflexible and does not allow for nested
option scopes or easily finding the value of an option at any arbitrary scope
without having to do long handwritten switch-case statements like in
`get_varp()`. `.indir` is also confusing and redundant since option indices for
each scope can be autogenerated.
Solution:
Expand option scopes in such a way that an option can support any amount of
scopes using a set of scope flags, similarly to how it's already done for option
types. Also make options contain information about its index at each scope it
supports. This allows for massively simplifying `get_varp()` and
`get_varp_scope()` in the future by just using a struct for options at each
scope. This would be done by creating a table that stores the offset of an
option's variable at a scope by using the option's index at that scope as a key.
This PR also autogenerates enums for option indices at each scope to remove the
need for `.indir` entirely, and also to allow easily iterating over options all
options that support any scope.
Ref: #29314
Diffstat (limited to 'runtime/lua/vim/_meta/api.lua')
0 files changed, 0 insertions, 0 deletions