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

Toggle plugin views using 'when' contexts #386

Merged
merged 1 commit into from
Nov 28, 2020

Conversation

cscorley
Copy link
Contributor

@cscorley cscorley commented Nov 27, 2020

Hi team!

I started off a bit frustrated and almost requested a feature, but I figured it was simple enough I might be able to figure it out on my own and learn a bit of extension writing.

Essentially, I did not like "Dendron Tree View" and "Backlinks" in my view pane while working in non-Dendron workspaces. I know these can be toggled off, but I thought it better if Dendron managed this itself. This PR enables Dendron view panes selectively (i.e., when Dendron is actually active) using 'when' contexts. I am not entirely sure if this covers every place Dendron becomes active, but the manual testing I completed shows the idea works.

I am not sure how to write a test for this. Ideally, I would also store these keys into constants.ts, but I am also unsure if there should be a new enum defined or if this cleanly fits elsewhere. Additionally, I think this should be configurable somehow, but I'm not very familiar with how to accomplish that either. Thanks!

@kevinslin
Copy link
Member

First, thanks for the PR. appreciate you taking the time to send a PR instead of just filing an issue (though issues are welcomed to).

As far as testing, Dendron basically mocks the vscode extension context to test activation because tests are interrupted whenever vscode reloads a workspace. We're currently refactoring the tests to have a uniform interface (we've evolved our testing harness over the past few months) so I'm going to merge this as is.

As for adding using a constants keys - yes, that would be desired. We'll add that in when we finish refactoring the test.

@kevinslin kevinslin merged commit 01282fb into dendronhq:master Nov 28, 2020
@cscorley cscorley deleted the toggle-on-workspace branch November 28, 2020 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants