-
Notifications
You must be signed in to change notification settings - Fork 112
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 proposal: move parser to a separate crate #463
Comments
This seems like it should be reasonable enough to do since configuration parsing is fairly independent of runtime processing. I don't have much knowledge about implementing LSP so I'm not sure what other interfaces would be needed for the parsing/config crate. I suppose it could just start off with the current interfaces that the rest of the kanata code uses which would be parsing a file to return the |
Makes sense. Since you agreed, I'll start working on a PR. |
Or would you rather do it yourself? The amount of changes would be huge. I'm pretty sure that everything else besides
We could ignore this for now, as it only complicates things even more. |
Instead of just moving everything out, another possibility would be to alter parser code to add an intermediate tree representation that wouldn't be dependent of To still have a validation of keys like the Lines 83 to 88 in 41878c5
OsCode , the parser crate could instead have mapping key_str => description_of_key (it would work as a documentation).
But that's only one of changes that would need to be made. |
I don't have as much time+motivation to work on OSS these days so I wouldn't be able to make any promises for when it would get done.
As a first thought, it seems like it would require a lot of changes since currently all of the parsing functions return a keyberon
Ah good callout. I don't think this is necessary though, this part of the dependency should be removed in #466. I think the |
so far config variables can not be changed during runtime, but maybe read-write variables become a thing in the future. |
I mean, just moving the parser as is to another crate shouldn't be much of a problem time-wise. I was trying to say that it would be PITA for you to review the changes if I did them, because git diff sadly can't show "renamed file X for Y" but rather treats renames as deleting a file and adding a completely different file. If you're okay with that, I can do the changes.
Probably not. That's because the config parser is, just like jtroo said,
and writing variables would be done only in runtime. But this is only hypothetical, because there seems to be no good reason to have them in kanata. |
One strategy to mitigate this is to have one commit in the history be moving the files as-is and then the rest of the commits are the actual changes. |
Okay, I can do that |
I just found out |
Changes I suggest to make:
Reasoning:
Having the parser code in a separate crate will allow future tools like UI confgurator or even a LSP server to reuse the existing parser. I've personally stated interest in developing of such tools in #42 a while ago. This change could push forward #42.
The text was updated successfully, but these errors were encountered: