Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit f077fbb

Browse files
committed
fix: disable "focus active document" comment when not using Sourcegraph
1 parent a741da2 commit f077fbb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@
138138
"icon": {
139139
"light": "icons/focus-light.svg",
140140
"dark": "icons/focus-dark.svg"
141-
}
141+
},
142+
"enablement": "sourcegraph.canFocusActiveDocument"
142143
},
143144
{
144145
"command": "extension.openFile",

src/commands/openSourcegraphUriCommand.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { CompareRange, SourcegraphUri } from '../file-system/SourcegraphUri'
44
import { log } from '../log'
55

66
export async function openSourcegraphUriCommand(fs: SourcegraphFileSystemProvider, uri: SourcegraphUri): Promise<void> {
7-
log.appendLine(`uri=${uri.uri}`)
87
if (uri.compareRange) {
98
await openCompareUri(uri, uri.compareRange)
109
return

src/file-system/FilesTreeDataProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ export class FilesTreeDataProvider implements vscode.TreeDataProvider<string> {
133133
this.didFocusToken.cancel()
134134
this.didFocusToken = new vscode.CancellationTokenSource()
135135
this.activeUri = vscodeUri
136+
vscode.commands
137+
.executeCommand('setContext', 'sourcegraph.canFocusActiveDocument', vscodeUri?.scheme === 'sourcegraph')
138+
.then(
139+
() => {},
140+
() => {}
141+
)
136142
if (vscodeUri && vscodeUri.scheme === 'sourcegraph' && this.treeView && this.isTreeViewVisible) {
137143
const uri = this.fs.sourcegraphUri(vscodeUri)
138144
await this.fs.downloadFiles(uri)

0 commit comments

Comments
 (0)