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

Implement simple current topic information cache #355

Merged
merged 2 commits into from Jan 30, 2020

Conversation

vexx32
Copy link
Owner

@vexx32 vexx32 commented Jan 29, 2020

PR Summary

Adds functionality to Get-Karma to set a transient module-scoped variable containing information on the current topic (topic, current line, completion, etc.)

This can then be used in Show-Karma -Contemplate to quickly open the editor without the need to call Get-Karma all over again. The value is then cleared from the variable, so that subsequent calls to Show-Karma -Contemplate aren't blindly assuming that no progress has been made.

Context

Resolves #351

Changes

  • Store CurrentTopic data in $script:CurrentTopic module-scoped variable just before Get-Karma submits its output
  • Reuse this information when it is available in Show-Karma -Contemplate and then immediately clear it.
  • Updated tests to expect this behaviour.

Checklist

  • Pull Request has a meaningful title.
  • Summarised changes.
  • Pull Request is ready to merge & is not WIP.
  • Added tests / only testable interactively.
    • Make sure you add a new test if old tests do not effectively test the code changed.
  • Added documentation / opened issue to track adding documentation at a later date.

Adds functionality to store topic completion data to a module-scope var
with Get-Karma.
This simple cache will then be pulled and subsequently cleared by
Show-Karma when used with -Contemplate.

If there is no cached data, Show-Karma will call Get-Karma.

The cache allows us to avoid double-calling Get-Karma when, for example,
the user calls Show-Karma to view results and then follows with
Show-Karma -Contemplate to open the file.
@vexx32 vexx32 added PR-Needs-Review 🔍 Let's take a closer look! Category-Module Pertaining to the module's functionality itself. labels Jan 29, 2020
@vexx32 vexx32 added this to In Progress in Module Features / Bugfixes Progress via automation Jan 29, 2020
@vexx32 vexx32 force-pushed the Feature/CacheCurrentTopic branch 4 times, most recently from 156e055 to 95d76c9 Compare January 29, 2020 05:33
- Update Get-Karma tests to ensure variable is set
- Update Show-Karma tests to ensure variable
is properly used and subsequently cleared.
@vexx32 vexx32 removed the PR-Needs-Review 🔍 Let's take a closer look! label Jan 30, 2020
@vexx32 vexx32 merged commit f69405a into master Jan 30, 2020
Module Features / Bugfixes Progress automation moved this from In Progress to Closed Jan 30, 2020
@vexx32 vexx32 deleted the Feature/CacheCurrentTopic branch January 30, 2020 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Module Pertaining to the module's functionality itself.
Development

Successfully merging this pull request may close these issues.

Cache Current Topic Data
1 participant