Skip to content

Commit

Permalink
Separate out feature flag (#1826)
Browse files Browse the repository at this point in the history
  • Loading branch information
sourishkrout authored Nov 27, 2024
1 parent 9ff78c3 commit 8993487
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
}
}
},
"OpenTerminalOnStartup": {
"enabled": false,
"conditions": {
"enabledForExtensions": {
"stateful.platform": false,
"stateful.runme": true
}
}
},
"NewTreeProvider": {
"enabled": false,
"conditions": {
Expand Down
3 changes: 3 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ export class RunmeExtension {
// only ever enabled in hosted playground
if (features.isOnInContextState(FeatureName.HostedPlayground)) {
await features.addTrustedDomains()
}

if (features.isOnInContextState(FeatureName.OpenTerminalOnStartup)) {
await features.autoOpenTerminal()
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/extension/features/autoOpenTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import ContextState from '../contextState'
import { isOnInContextState } from '.'

export async function autoOpenTerminal() {
if (!isOnInContextState(FeatureName.HostedPlayground)) {
if (!isOnInContextState(FeatureName.OpenTerminalOnStartup)) {
return
}

if (!ContextState.getKey<boolean>(`${FeatureName.HostedPlayground}.autoOpenTerminal`)) {
if (!ContextState.getKey<boolean>(`${FeatureName.OpenTerminalOnStartup}.autoOpenTerminal`)) {
await commands.executeCommand('workbench.action.terminal.new')
await ContextState.addKey(`${FeatureName.HostedPlayground}.autoOpenTerminal`, true)
await ContextState.addKey(`${FeatureName.OpenTerminalOnStartup}.autoOpenTerminal`, true)
}
}
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ export enum FeatureName {
RequireStatefulAuth = 'RequireStatefulAuth',
CopySelectionToClipboard = 'CopySelectionToClipboard',
NewTreeProvider = 'NewTreeProvider',
OpenTerminalOnStartup = 'OpenTerminalOnStartup',
HostedPlayground = 'HostedPlayground',
RecommendExtension = 'RecommendExtension',
}
Expand Down

0 comments on commit 8993487

Please sign in to comment.