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

Partially load the config even when there is an error #22

Open
antoyo opened this issue May 29, 2024 · 2 comments
Open

Partially load the config even when there is an error #22

antoyo opened this issue May 29, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@antoyo
Copy link

antoyo commented May 29, 2024

That's an issue I opened in the original helix repo, but was closed since they didn't want to add more complexity to the current TOML config since it's going to be replaced by a Scheme-based config in the future.

What would be your thoughts on the ability the partially load the config?

Since the goal of this project is to avoid Scheme, what do you plan to use instead for the config? Is the plan to keep TOML or switch to a real programming language?

Here's the text from the original issue:

It would be nice if the config could ignore the errors and continue loading the settings that work.
For instance, if I write heme instead of theme, helix will show the following error:

Bad config: unknown field `heme`, expected one of `theme`, `lsp`, `keys`, `editor` at line 1 column 1
Press <ENTER> to continue with default config

but it won't continue loading the other settings, which is inconvenient because you lose your key bindings for instance.

@usagi-flow
Copy link
Owner

Thank you, these are good questions and a great improvement suggestion.

Since the goal of this project is to avoid Scheme, what do you plan to use instead for the config? Is the plan to keep TOML or switch to a real programming language?

As you noted correctly, the rough plan is to keep TOML, or, if it makes sense, switch to something at least as simple and declarative as the current TOML solution. I can't say exactly what the solution will look like once Helix drops TOML support, because that depends on the final plugin system implementation in Helix, and it isn't clear enough yet how it'll be implemented.

One solution would be for this project to simply restore and keep maintaining the TOML deserialization layer, whose strength is its simplicity - IMO. However, if the Helix API changes too considerably, this might cause too much maintenance effort as time goes by.

A more sustainable alternative in this case would be to actually use the new system, but introduce a TOML deserialization layer between this new plugin system and the actual config file. A first very rough prototype PR in Helix seeked to make this possible. This would probably be the best way to go, but also cause some more initial effort.

What would be your thoughts on the ability the partially load the config?

It makes sense and it's something that should be supported as long as we support TOML.

I'll have to have a closer look at how this could be implemented, but I could imagine catching the errors and storing them, then log out all config errors in the log, and maybe show a message under the statusline like "Hey, something's wrong with your config, check logs for more details". (I'm open for PRs of course!)

@usagi-flow usagi-flow added the enhancement New feature or request label Jun 1, 2024
@antoyo
Copy link
Author

antoyo commented Jun 2, 2024

Ok, thanks for the explanation.
I guess you could take a look at the PR I linked above so that you can tell whether this will cause friction while keeping this project in sync with helix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants