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: combine two context files into one #396

Merged
merged 2 commits into from
Aug 19, 2022

Conversation

agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Jul 22, 2022

Summary

Merge the two context files into a single file as they're intended to be as similar as possible. They're also not meant to be more extensible to create other contexts (unlike say, the cache interfaces etc), these are the only two contexts intended.

IMO, the slight, small distinction between them would've been easier to understand/catch on to if I saw them together like this than in separate files.

Details

  • they're virtually identical, so combine them instead of keeping them separate

    • changes to one should probably be made to both
    • still a < 100 LoC file
  • refactor out _.isFunction with a simple getText function instead

  • add docstrings about when to use the two contexts

Future Work

  • I'd like to do something similar with the diagnostics files and the tsconfig files, as they're also only used in the same context and not in other contexts. Planning to add more unit tests first though

- they're virtually identical, so combine them instead of keeping them separate
  - changes to one should probably be made to both
  - still a < 100 LoC file

- refactor out `_.isFunction` with a simple `getText` function instead
  - checks the opposite
  - one more lodash removal!

- add docstrings about when to use the two contexts
@agilgur5 agilgur5 added the kind: internal Changes only affect the internals, and _not_ the public API or external-facing docs label Jul 22, 2022
@agilgur5
Copy link
Collaborator Author

Very likely that ConsoleContext will be removed per my realization in #345 (comment), but this PR will also make it easier to remove it as all the code is now in this one file and all the imports are from this one file

@ezolenko ezolenko merged commit c1f3a35 into ezolenko:master Aug 19, 2022
@agilgur5 agilgur5 deleted the refactor-combine-contexts branch July 2, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: internal Changes only affect the internals, and _not_ the public API or external-facing docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants