Add new APIs: isBuildingResourcesForTab & getShownResult#49
Open
RyotaUshio wants to merge 1 commit intojavalent:mainfrom
Open
Add new APIs: isBuildingResourcesForTab & getShownResult#49RyotaUshio wants to merge 1 commit intojavalent:mainfrom
RyotaUshio wants to merge 1 commit intojavalent:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, thank you for maintaining this project. I'd like to suggest some addition to the plugin API. Let me know if you have any suggestions. Also please feel free to reject this PR if it doesn't make sense to you.
Pull Request Description
Problem
I'm currently working on a plugin where its setting tab renders a tree view dynamically, which means the leaves (= each
Setting) are not available when Settings Search builds resources.I can work around this by either using the current API (
window.SettingsSearch.addResources, etc.) or using a hack like this:Of course this method is too hacky and unreliable, but the biggest problem is that, when a user searches for a specific leaf setting and click the arrow button, the user cannot jump to the setting because the tree is collapsed in this time and the destination setting is not rendered yet.
Solution
This problem can be solved by providing new APIs:
isBuildingResoucesForTabandgetShownResult.The current
showResultmethod seems to include additional logic to handle Style Settings and Excalidraw (and other plugins with<detail>-based tree views), by providing thegetShownResultAPI, any plugin will be able to be compatible with Settings Search without hard coding their own logics in Settings Search's code.Changes Proposed
SettingsSearch.tabCachedproperty that indicates which tab is being cached, andSettingsSearch.isBuildingResourcesForTab(tab: SettingTab): booleanmethod to check a given tab is being cached.SettingsSearch.shownResultproperty that holds the resource passed to theshowResultmethod, andSettingsSearch.getShownResult(): Resouce | nullas a getter.isBuildingResourcesForTabandgetShownResultto the public plugin API.Related Issues
Not exactly, but related: #21
Checklist
Screenshots (if applicable)
Not applicable
Additional Notes
Not applicable