Skip to content
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

refactor(options): generate available options values from lua #28659

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

glepnir
Copy link
Member

@glepnir glepnir commented May 7, 2024

Problem: currently the available values of options is split from options meta lua file.

Solution: generate it from lua file.

@github-actions github-actions bot added the build building and installing Neovim using the provided scripts label May 7, 2024
@glepnir glepnir requested a review from justinmk May 7, 2024 09:37
@github-actions github-actions bot added refactor changes that are not features or bugfixes options configuration, settings labels May 7, 2024
src/nvim/options.lua Outdated Show resolved Hide resolved
Comment on lines +3 to +4
local gen_values = options_file:find('options_values') and true or false

Copy link
Member

@famiu famiu May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this pattern of using the same generator for 2 completely different purposes. Use a separate generator file for this, similar to what gen_options_enum.lua does

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not "complete different purposes". And why is gen_options_enum.lua in a separate file?

Copy link
Member

@famiu famiu May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not "complete different purposes".

The script does two very different things depending on which file it's being called on, that seems different to me. A script's behavior depending on the filename is certainly not ideal.

And why is gen_options_enum.lua in a separate file?

Precisely because it does a completely different thing. gen_options generates the options[] array, gen_options_enum generates the option index enum (using information from the options[] array, so order matters here) and the hash table for findoption()

@famiu famiu requested a review from lewis6991 May 7, 2024 18:48
@glepnir glepnir force-pushed the ref_opt_values branch 4 times, most recently from 8920fd4 to 340517c Compare May 8, 2024 12:41
Problem: currently the available values of options is split from options meta lua file.

Solution: generate it from lua file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build building and installing Neovim using the provided scripts options configuration, settings refactor changes that are not features or bugfixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants