Skip to content

Commit

Permalink
updates to the the new file flow
Browse files Browse the repository at this point in the history
refs #145046
  • Loading branch information
sbatten committed Apr 21, 2022
1 parent 3124b9a commit 8cad474
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ class UntitledTextEditorHintContentWidget implements IContentWidget {
if (!this.domNode) {
this.domNode = $('.untitled-hint');
this.domNode.style.width = 'max-content';

const editorType = $('a.editor-type');
editorType.style.cursor = 'pointer';
editorType.innerText = localize('notLookingForTextEditor', "Not looking for a text editor?");
const selectEditorTypeKeyBinding = this.keybindingService.lookupKeybinding('welcome.showNewFileEntries');
const selectEditorTypeKeybindingLabel = selectEditorTypeKeyBinding?.getLabel();
if (selectEditorTypeKeybindingLabel) {
editorType.title = localize('keyboardBindingTooltip', "{0}", selectEditorTypeKeybindingLabel);
}
this.domNode.appendChild(editorType);

this.domNode.appendChild($('br'));
this.domNode.appendChild($('br'));

const language = $('a.language-mode');
language.style.cursor = 'pointer';
language.innerText = localize('selectAlanguage2', "Select a language");
Expand All @@ -116,20 +130,6 @@ class UntitledTextEditorHintContentWidget implements IContentWidget {
}
this.domNode.appendChild(language);

const or = $('span');
or.innerText = localize('or', " or ",);
this.domNode.appendChild(or);

const chooseEditor = $('a.choose-editor');
chooseEditor.style.cursor = 'pointer';
chooseEditor.innerText = localize('chooseEditor', "select a different editor");
const chooseEditorKeyBinding = this.keybindingService.lookupKeybinding('welcome.showNewFileEntries');
const chooseEditorKeybindingLabel = chooseEditorKeyBinding?.getLabel();
if (chooseEditorKeybindingLabel) {
chooseEditor.title = localize('chooseEditorBindingTooltip', "{0}", chooseEditorKeybindingLabel);
}
this.domNode.appendChild(chooseEditor);

const toGetStarted = $('span');
toGetStarted.innerText = localize('toGetStarted', " to get started. Start typing to dismiss, or ",);
this.domNode.appendChild(toGetStarted);
Expand Down Expand Up @@ -165,9 +165,9 @@ class UntitledTextEditorHintContentWidget implements IContentWidget {
this.editorGroupsService.activeGroup.closeEditor(activeEditorInput, { preserveFocus: true });
}
};
this.toDispose.push(dom.addDisposableListener(chooseEditor, 'click', chooseEditorOnClickOrTap));
this.toDispose.push(dom.addDisposableListener(chooseEditor, GestureEventType.Tap, chooseEditorOnClickOrTap));
this.toDispose.push(Gesture.addTarget(chooseEditor));
this.toDispose.push(dom.addDisposableListener(editorType, 'click', chooseEditorOnClickOrTap));
this.toDispose.push(dom.addDisposableListener(editorType, GestureEventType.Tap, chooseEditorOnClickOrTap));
this.toDispose.push(Gesture.addTarget(editorType));

const dontShowOnClickOrTap = () => {
this.configurationService.updateValue(untitledTextEditorHintSetting, 'hidden');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.files.action.createFileFromExplorer',
title: nls.localize('createNewEditor', "New Editor"),
title: nls.localize('createNewFile', "New File"),
f1: false,
icon: Codicon.newFile,
precondition: ExplorerResourceNotReadonlyContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ type GettingStartedStartEntryContent = BuiltinGettingStartedStartEntry[];
export const startEntries: GettingStartedStartEntryContent = [
{
id: 'welcome.showNewFileEntries',
title: localize('gettingStarted.newEditor.title', "New Editor..."),
description: localize('gettingStarted.newEditor.description', "Open a new untitled file, notebook, or custom editor."),
title: localize('gettingStarted.newFile.title', "New File..."),
description: localize('gettingStarted.newFile.description', "Open a new untitled file, notebook, or custom editor."),
icon: Codicon.newFile,
content: {
type: 'startEntry',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ registerAction2(class extends Action2 {
constructor() {
super({
id: 'welcome.showNewFileEntries',
title: { value: localize('welcome.newEditor', "New Editor..."), original: 'New Editor...' },
title: { value: localize('welcome.newFile', "New File..."), original: 'New File...' },
category,
f1: true,
keybinding: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const apiMenus: IAPIMenu[] = [
{
key: 'file/newFile',
id: MenuId.NewFile,
description: localize('file.newEditor', "The 'New Editor...' quick pick, shown on welcome page and File menu."),
description: localize('file.newFile', "The 'New File...' quick pick, shown on welcome page and File menu."),
supportsSubmenus: false,
},
{
Expand Down

0 comments on commit 8cad474

Please sign in to comment.