Skip to content

Commit

Permalink
Explore terminal as a startup editor
Browse files Browse the repository at this point in the history
  • Loading branch information
lramos15 committed Jul 21, 2022
1 parent 81fff43 commit de17d3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { ActivitybarPart } from 'vs/workbench/browser/parts/activitybar/activity
import { AuxiliaryBarPart } from 'vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { LayoutStateKeys, LayoutStateModel, WorkbenchLayoutSettings } from 'vs/workbench/browser/layoutState';
import { Schemas } from 'vs/base/common/network';

interface IWorkbenchLayoutWindowRuntimeState {
fullscreen: boolean;
Expand Down Expand Up @@ -597,7 +598,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}

// Empty workbench configured to open untitled file if empty
else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && this.configurationService.getValue('workbench.startupEditor') === 'newUntitledFile') {
else if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
const startupEditor = this.configurationService.getValue<string>('workbench.startupEditor');

if (startupEditor !== 'newUntitledFile' && startupEditor !== 'terminal') {
return [];
}
if (this.editorGroupService.hasRestorableState) {
return []; // do not open any empty untitled file if we restored groups/editors from previous session
}
Expand All @@ -607,7 +613,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return []; // do not open any empty untitled file if we have backups to restore
}

return [{ resource: undefined }]; // open empty untitled file
if (startupEditor === 'terminal') {
return [{ resource: URI.from({ scheme: Schemas.vscodeTerminal, path: 'startup' }), options: { override: 'terminalEditor' } }];
} else {
return [{ resource: undefined }]; // open empty untitled file
}

}

return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,14 @@ configurationRegistry.registerConfiguration({
'workbench.startupEditor': {
'scope': ConfigurationScope.RESOURCE,
'type': 'string',
'enum': ['none', 'welcomePage', 'readme', 'newUntitledFile', 'welcomePageInEmptyWorkbench'],
'enum': ['none', 'welcomePage', 'readme', 'newUntitledFile', 'welcomePageInEmptyWorkbench', 'terminal'],
'enumDescriptions': [
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.none' }, "Start without an editor."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePage' }, "Open the Welcome page, with content to aid in getting started with VS Code and extensions."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.readme' }, "Open the README when opening a folder that contains one, fallback to 'welcomePage' otherwise. Note: This is only observed as a global configuration, it will be ignored if set in a workspace or folder configuration."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.newUntitledFile' }, "Open a new untitled file (only applies when opening an empty window)."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePageInEmptyWorkbench' }, "Open the Welcome page when opening an empty workbench."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.terminal' }, "Open a new terminal in the editor area."),
],
'default': 'welcomePage',
'description': localize('workbench.startupEditor', "Controls which editor is shown at startup, if none are restored from the previous session.")
Expand Down

0 comments on commit de17d3c

Please sign in to comment.