Skip to content

Commit 932088f

Browse files
committed
Adds support for workspace trust
1 parent a65f571 commit 932088f

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
88

99
### Added
1010

11+
- Adds support for Workspace Trust
1112
- Adds rich hovers to commits in the views — including associated pull requests (when connected to GitHub) and auto-linked issues
1213
- Adds a new section for associated pull requests (when connected to GitHub) and auto-linked issues to the _Details_ hover
1314
- Adds the ability to filter comparisons to show only either the left-side or right-side file differences

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@
194194
"onCommand:gitlens.pushRepositories",
195195
"onStartupFinished"
196196
],
197+
"capabilities": {
198+
"virtualWorkspaces": false,
199+
"untrustedWorkspaces": {
200+
"supported": "limited"
201+
}
202+
},
197203
"contributes": {
198204
"configuration": {
199205
"type": "object",
@@ -7634,7 +7640,7 @@
76347640
},
76357641
{
76367642
"command": "gitlens.views.createPullRequest",
7637-
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(tracking|remote)\\b)/",
7643+
"when": "gitlens:hasRemotes && !gitlens:readonly && gitlens:action:createPullRequest && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(tracking|remote)\\b)/",
76387644
"group": "inline@9"
76397645
},
76407646
{
@@ -7726,7 +7732,7 @@
77267732
},
77277733
{
77287734
"command": "gitlens.views.createPullRequest",
7729-
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(tracking|remote)\\b)/",
7735+
"when": "gitlens:hasRemotes && !gitlens:readonly && gitlens:action:createPullRequest && viewItem =~ /gitlens:branch\\b(?=.*?\\b\\+(tracking|remote)\\b)/",
77307736
"group": "1_gitlens_actions_@9"
77317737
},
77327738
{
@@ -8391,7 +8397,7 @@
83918397
},
83928398
{
83938399
"command": "gitlens.views.createPullRequest",
8394-
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
8400+
"when": "gitlens:hasRemotes && !gitlens:readonly && gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
83958401
"group": "inline@3"
83968402
},
83978403
{
@@ -8432,7 +8438,7 @@
84328438
},
84338439
{
84348440
"command": "gitlens.views.createPullRequest",
8435-
"when": "gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
8441+
"when": "gitlens:hasRemotes && !gitlens:readonly && gitlens:action:createPullRequest && viewItem =~ /gitlens:status:upstream:(?!none)/",
84368442
"group": "1_gitlens_secondary_actions@3"
84378443
},
84388444
{

src/extension.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ export async function activate(context: ExtensionContext): Promise<GitLensApi |
4343
// Pretend we are enabled (until we know otherwise) and set the view contexts to reduce flashing on load
4444
void setContext(ContextKeys.Enabled, true);
4545

46+
if (!workspace.isTrusted) {
47+
void setContext(ContextKeys.Readonly, true);
48+
context.subscriptions.push(
49+
workspace.onDidGrantWorkspaceTrust(() => void setContext(ContextKeys.Readonly, undefined)),
50+
);
51+
}
52+
4653
setKeysForSync();
4754

4855
Logger.configure(context, configuration.get('outputLevel'), o => {

0 commit comments

Comments
 (0)