Check for Workspace Trust

Any feature that causes dynamic code execution (code supplied or modifiable that is outside of the published Dendron extension) must first check whether the user has enabled workspace trust. Some examples of this are Hooks (Private) and Traits (Private).

To check whether workspace trust has been enabled, you can use VSCode's API: vscode.workspace.isTrusted. If working in the context of EngineAPIService, there is also a private member that contains the trust information (currently _trustedWorkspace).

If your scenario is blocked because the user hasn't enabled workspace trust, please add an notification prompt to the user explaining that the scenario didn't run because the workspace is not trusted.


Backlinks