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 language.rs #205

Closed
o2sh opened this issue Sep 3, 2020 · 1 comment
Closed

Refactor language.rs #205

o2sh opened this issue Sep 3, 2020 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@o2sh
Copy link
Owner

o2sh commented Sep 3, 2020

Currently, adding support for a new language requires modifying the language.rs at multiple locations.
This process can be quite cumbersome and error prone (especially for new contributors).

Some shortcuts can be taken:

  • Assuming the ascii file to be in "../resources/language.ascii" => match case in get_ascii_art() no more needed
  • Using tokei::LanguageType instead of our own Enum, else (if not possible) assume that the name matches => match case in fn from(language: tokei::LanguageType) no more needed.
  • ...
@o2sh o2sh added enhancement New feature or request help wanted Extra attention is needed labels Sep 3, 2020
@spenserblack
Copy link
Collaborator

spenserblack commented Sep 3, 2020

We might be able use a macro for most language definition, since it's fairly repetitive code. This macro could also define tests.

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

No branches or pull requests

2 participants