Fix #127785
This commit is contained in:
parent
66e4d31ac8
commit
8e16690b35
2 changed files with 14 additions and 1 deletions
|
@ -15,7 +15,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
|
|||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { EditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IGettingStartedNewMenuEntryDescriptorCategory, IGettingStartedService } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedService';
|
||||
import { HasMultipleNewFileEntries, IGettingStartedNewMenuEntryDescriptorCategory, IGettingStartedService } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedService';
|
||||
import { GettingStartedInput } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedInput';
|
||||
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
|
@ -199,6 +199,7 @@ registerAction2(class extends Action2 {
|
|||
},
|
||||
menu: {
|
||||
id: MenuId.MenubarFileMenu,
|
||||
when: HasMultipleNewFileEntries,
|
||||
group: '1_new',
|
||||
order: 3
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/plat
|
|||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
|
||||
export const WorkspacePlatform = new RawContextKey<'mac' | 'linux' | 'windows' | undefined>('workspacePlatform', undefined, localize('workspacePlatform', "The platform of the current workspace, which in remote contexts may be different from the platform of the UI"));
|
||||
export const HasMultipleNewFileEntries = new RawContextKey<boolean>('hasMultipleNewFileEntries', false);
|
||||
|
||||
export const IGettingStartedService = createDecorator<IGettingStartedService>('gettingStartedService');
|
||||
|
||||
|
@ -309,6 +310,8 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
e.affectedKeys.forEach(key => { this.progressByEvent('onSettingChanged:' + key); });
|
||||
}));
|
||||
|
||||
HasMultipleNewFileEntries.bindTo(this.contextService).set(false);
|
||||
|
||||
this.remoteAgentService.getEnvironment().then(env => {
|
||||
const remoteOS = env?.os;
|
||||
|
||||
|
@ -672,6 +675,10 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
private registerNewMenuItem(categoryDescriptor: IGettingStartedNewMenuEntryDescriptor) {
|
||||
this.newMenuItems.push(categoryDescriptor);
|
||||
this.newMenuItems.sort((a, b) => b.category - a.category);
|
||||
if (categoryDescriptor.category === IGettingStartedNewMenuEntryDescriptorCategory.file || categoryDescriptor.category === IGettingStartedNewMenuEntryDescriptorCategory.notebook) {
|
||||
HasMultipleNewFileEntries.bindTo(this.contextService).set(true);
|
||||
}
|
||||
|
||||
this._onDidAddNewEntry.fire();
|
||||
}
|
||||
|
||||
|
@ -697,6 +704,11 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
}
|
||||
|
||||
this.newMenuItems = this.newMenuItems.filter(entry => entry.sourceExtensionId !== extension.identifier.value);
|
||||
HasMultipleNewFileEntries.bindTo(this.contextService).set(
|
||||
this.newMenuItems.filter(entry =>
|
||||
entry.category === IGettingStartedNewMenuEntryDescriptorCategory.file
|
||||
|| entry.category === IGettingStartedNewMenuEntryDescriptorCategory.notebook).length > 1
|
||||
);
|
||||
}
|
||||
|
||||
private registerDoneListeners(step: IGettingStartedStep) {
|
||||
|
|
Loading…
Reference in a new issue