From 3358aefea64f34dbec8bcc3e8ef1a1492809a798 Mon Sep 17 00:00:00 2001 From: netcon Date: Mon, 22 Jan 2024 20:17:59 +0800 Subject: [PATCH] chore: bump vscode to 1.85.2 (#546) --- package.json | 2 +- vscode-web/.VERSION | 2 +- vscode-web/package.json | 2 +- vscode-web/scripts/.patch | 19 +- .../vs/code/browser/workbench/workbench.ts | 3 +- .../vs/editor/common/config/editorOptions.ts | 72 +- .../parts/activitybar/activitybarPart.ts | 23 +- .../browser/parts/globalCompositeBar.ts | 666 ------------------ .../parts/titlebar/media/titlebarpart.css | 30 +- .../src/vs/workbench/browser/web.main.ts | 14 +- .../files/browser/editors/fileEditorInput.ts | 27 +- .../contrib/webview/browser/pre/index.html | 4 + .../editor/browser/editorResolverService.ts | 13 +- .../builtinExtensionsScannerService.ts | 3 +- yarn.lock | 8 +- 15 files changed, 144 insertions(+), 744 deletions(-) delete mode 100644 vscode-web/src/vs/workbench/browser/parts/globalCompositeBar.ts diff --git a/package.json b/package.json index db8e350ed..799284fd5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lib": "lib" }, "devDependencies": { - "@github1s/vscode-web": "0.15.0", + "@github1s/vscode-web": "0.16.0", "@typescript-eslint/eslint-plugin": "^5.40.1", "@typescript-eslint/parser": "^5.40.1", "chokidar": "^3.5.3", diff --git a/vscode-web/.VERSION b/vscode-web/.VERSION index 2726943bf..8d2b17140 100644 --- a/vscode-web/.VERSION +++ b/vscode-web/.VERSION @@ -1 +1 @@ -1.84.2 \ No newline at end of file +1.85.2 \ No newline at end of file diff --git a/vscode-web/package.json b/vscode-web/package.json index 25875ebdb..e6897e7cf 100644 --- a/vscode-web/package.json +++ b/vscode-web/package.json @@ -1,6 +1,6 @@ { "name": "@github1s/vscode-web", - "version": "0.15.0", + "version": "0.16.0", "description": "VS Code web for GitHub1s", "author": "github1s", "license": "MIT", diff --git a/vscode-web/scripts/.patch b/vscode-web/scripts/.patch index eb4ba1abc..83b8d5c97 100644 --- a/vscode-web/scripts/.patch +++ b/vscode-web/scripts/.patch @@ -1,14 +1,13 @@ { - "vs/code/browser/workbench/workbench.ts": "a954327b52b6ed462b3b7fbd2301c6ba11bf135ca7ba70c5f552214309492946", - "vs/editor/common/config/editorOptions.ts": "043c420c18f97c42b9fa45a0f12b10ab81f464a3d3293d177dfbf4d63e4693be", - "vs/workbench/browser/parts/activitybar/activitybarPart.ts": "7396307c8bcf88eb7b306fbe5c3648a4eeb7fe817de4f508ed6ce256d3aab9ea", - "vs/workbench/browser/parts/titlebar/media/titlebarpart.css": "12ee25ef0c98f63a6f3dbc3d78c648408db81c165aa547d8c7dcfe89c5d25e8c", - "vs/workbench/browser/web.main.ts": "6fe9eeb0cdebd7e95fcb7da48524aded5b544b41a31752486e8351cd505ab9f5", - "vs/workbench/contrib/files/browser/editors/fileEditorInput.ts": "27714e54f72edb805459d991c607d2867bd791e46d4c58eb4ab1a418f767e817", - "vs/workbench/contrib/webview/browser/pre/index.html": "6dc11aefde8587732dba85116dac2718cef9287075c8d3a306663a7741e6910f", - "vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts": "3cc4c831bcffc9b2837890d64c651ba5508af9e9693d6d2cf425305ff27cba9f", + "vs/code/browser/workbench/workbench.ts": "66d3d7f717a67bf5b4432e1968fa68c1af8fa5552df7e958afd07c64cde3e247", + "vs/editor/common/config/editorOptions.ts": "96ffe6e1c00b19b8866e4bb5505241681f8d9956558127bb7b0b369ca4d30d52", + "vs/workbench/browser/parts/activitybar/activitybarPart.ts": "d86dbe51c3371291a5d23a9d359f7d6e19568d6d46a859f908d25b4d5b9e5448", + "vs/workbench/browser/parts/titlebar/media/titlebarpart.css": "cbbe54c7a07edb4abac784cc9a611a44866fa04a18b79f601e3588cbcf3bbbfe", + "vs/workbench/browser/web.main.ts": "3bb15c0567d512161cd0ed27e4e38169888e410467b56974ff1613baa349dbe9", + "vs/workbench/contrib/files/browser/editors/fileEditorInput.ts": "26148e61f419d2afa6b35f6ae551af9faafb133a01a7fcac6f859c8c44526216", + "vs/workbench/contrib/webview/browser/pre/index.html": "256fae7173fdabfed8963f6d15852609b15630d6e68ddbc281def651a23c76bb", + "vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts": "a301513f75bdecf781c0e8703e0c2f22c164039972dcbc99b12524f2073ccc43", "vs/workbench/services/label/common/labelService.ts": "73237cce0f9496151ea8ae5079676bbdfa15ce49de9b05621d39fcd04e9c1f0d", "vs/workbench/services/textfile/browser/textFileService.ts": "193176bfccbbeae7fdf7b546992647554503dc4df8579db7094a4eee3cf50451", - "vs/workbench/services/editor/browser/editorResolverService.ts": "43cd774a4715e98afaf85b3d44f0381d0b83dc1b9cd75fc090553f84fa0f7e80", - "vs/workbench/browser/parts/globalCompositeBar.ts": "d3ae76e7831976c34be6b9bf07eb87b05eb46d45eb7ebff039169a8f5372ff87" + "vs/workbench/services/editor/browser/editorResolverService.ts": "79831ee3ed18eb8c25a41baf9bc4060f2330468d636c7c142fd238389ce97775" } \ No newline at end of file diff --git a/vscode-web/src/vs/code/browser/workbench/workbench.ts b/vscode-web/src/vs/code/browser/workbench/workbench.ts index f62239ca3..652ab897d 100644 --- a/vscode-web/src/vs/code/browser/workbench/workbench.ts +++ b/vscode-web/src/vs/code/browser/workbench/workbench.ts @@ -5,8 +5,7 @@ import { create } from 'vs/workbench/workbench.web.main'; import { IExtensionManifest } from 'vs/platform/extensions/common/extensions'; -import { IWorkbenchConstructionOptions } from 'vs/workbench/browser/web.api'; -import { IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService'; +import { IWorkspaceProvider, IWorkbenchConstructionOptions } from 'vs/workbench/browser/web.api'; import { URI, UriComponents } from 'vs/base/common/uri'; import { env } from 'vs/workbench/browser/web.factory'; diff --git a/vscode-web/src/vs/editor/common/config/editorOptions.ts b/vscode-web/src/vs/editor/common/config/editorOptions.ts index 354c15a92..f80b87c36 100644 --- a/vscode-web/src/vs/editor/common/config/editorOptions.ts +++ b/vscode-web/src/vs/editor/common/config/editorOptions.ts @@ -559,14 +559,12 @@ export interface IEditorOptions { selectionHighlight?: boolean; /** * Enable semantic occurrences highlight. - * Defaults to true. - */ - occurrencesHighlight?: boolean; - /** - * Enable semantic occurrences highlight. - * Defaults to true. + * Defaults to 'singleFile'. + * 'off' disables occurrence highlighting + * 'singleFile' triggers occurrence highlighting in the current document + * 'multiFile' triggers occurrence highlighting across valid open documents */ - multiDocumentOccurrencesHighlight?: boolean; + occurrencesHighlight?: 'off' | 'singleFile' | 'multiFile'; /** * Show code lens * Defaults to true. @@ -2722,6 +2720,12 @@ class WrappingStrategy extends BaseEditorOption> class EditorLightbulb extends BaseEditorOption { constructor() { - const defaults: EditorLightbulbOptions = { enabled: true }; + const defaults: EditorLightbulbOptions = { enabled: true, experimental: { showAiIcon: ShowAiIconMode.Off } }; super( EditorOption.lightbulb, 'lightbulb', defaults, { @@ -2750,6 +2761,17 @@ class EditorLightbulb extends BaseEditorOption IAction[], - private readonly colors: (theme: IColorTheme) => ICompositeBarColors, - private readonly activityHoverOptions: IActivityHoverOptions, - @IConfigurationService configurationService: IConfigurationService, - @IInstantiationService private readonly instantiationService: IInstantiationService, - @IStorageService private readonly storageService: IStorageService, - @IExtensionService private readonly extensionService: IExtensionService, - ) { - super(); - - this.element = document.createElement('div'); - const anchorAlignment = configurationService.getValue('workbench.sideBar.location') === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT; - const anchorAxisAlignment = AnchorAxisAlignment.HORIZONTAL; - this.globalActivityActionBar = this._register(new ActionBar(this.element, { - actionViewItemProvider: action => { - if (action.id === GLOBAL_ACTIVITY_ID) { - return this.instantiationService.createInstance(GlobalActivityActionViewItem, this.contextMenuActionsProvider, { colors: this.colors, hoverOptions: this.activityHoverOptions }, anchorAlignment, anchorAxisAlignment); - } - - if (action.id === ACCOUNTS_ACTIVITY_ID) { - return this.instantiationService.createInstance(AccountsActivityActionViewItem, - this.contextMenuActionsProvider, - { - colors: this.colors, - hoverOptions: this.activityHoverOptions - }, - anchorAlignment, - anchorAxisAlignment, - (actions: IAction[]) => { - actions.unshift(...[ - toAction({ id: 'hideAccounts', label: localize('hideAccounts', "Hide Accounts"), run: () => this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, false, StorageScope.PROFILE, StorageTarget.USER) }), - new Separator() - ]); - }); - } - - throw new Error(`No view item for action '${action.id}'`); - }, - orientation: ActionsOrientation.VERTICAL, - ariaLabel: localize('manage', "Manage"), - animated: false, - preventLoopNavigation: true - })); - - if (this.accountsVisibilityPreference) { - this.globalActivityActionBar.push(this.accountAction, { index: GlobalCompositeBar.ACCOUNTS_ACTION_INDEX }); - } - - this.globalActivityActionBar.push(this.globalActivityAction); - - this.registerListeners(); - } - - private registerListeners(): void { - // Extension registration - const disposables = this._register(new DisposableStore()); - this._register(this.extensionService.onDidRegisterExtensions(() => { - this.storageService.onDidChangeValue(StorageScope.PROFILE, AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, disposables)(() => this.toggleAccountsActivity(), this, disposables); - })); - } - - create(parent: HTMLElement): void { - parent.appendChild(this.element); - } - - focus(): void { - this.globalActivityActionBar.focus(true); - } - - size(): number { - return this.globalActivityActionBar.viewItems.length; - } - - getContextMenuActions(): IAction[] { - return [toAction({ id: 'toggleAccountsVisibility', label: localize('accounts', "Accounts"), checked: this.accountsVisibilityPreference, run: () => this.accountsVisibilityPreference = !this.accountsVisibilityPreference })]; - } - - private toggleAccountsActivity() { - if (this.globalActivityActionBar.length() === 2 && this.accountsVisibilityPreference) { - return; - } - if (this.globalActivityActionBar.length() === 2) { - this.globalActivityActionBar.pull(GlobalCompositeBar.ACCOUNTS_ACTION_INDEX); - } else { - this.globalActivityActionBar.push(this.accountAction, { index: GlobalCompositeBar.ACCOUNTS_ACTION_INDEX }); - } - } - - private get accountsVisibilityPreference(): boolean { - return this.storageService.getBoolean(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, StorageScope.PROFILE, true); - } - - private set accountsVisibilityPreference(value: boolean) { - this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, value, StorageScope.PROFILE, StorageTarget.USER); - } -} - -abstract class AbstractGlobalActivityActionViewItem extends CompoisteBarActionViewItem { - - constructor( - private readonly menuId: MenuId, - action: CompositeBarAction, - options: ICompositeBarActionViewItemOptions, - private readonly contextMenuActionsProvider: () => IAction[], - private readonly anchorAlignment: AnchorAlignment | undefined, - private readonly anchorAxisAlignment: AnchorAxisAlignment | undefined, - @IThemeService themeService: IThemeService, - @IHoverService hoverService: IHoverService, - @IMenuService private readonly menuService: IMenuService, - @IContextMenuService private readonly contextMenuService: IContextMenuService, - @IContextKeyService private readonly contextKeyService: IContextKeyService, - @IConfigurationService configurationService: IConfigurationService, - @IKeybindingService keybindingService: IKeybindingService, - @IActivityService private readonly activityService: IActivityService, - ) { - super(action, { draggable: false, icon: true, hasPopup: true, ...options }, () => true, themeService, hoverService, configurationService, keybindingService); - - this.updateItemActivity(); - this._register(this.activityService.onDidChangeActivity(viewContainerOrAction => { - if (isString(viewContainerOrAction) && viewContainerOrAction === this.compositeBarActionItem.id) { - this.updateItemActivity(); - } - })); - } - - private updateItemActivity(): void { - const activities = this.activityService.getActivity(this.compositeBarActionItem.id); - let activity = activities[0]; - if (activity) { - const { badge, priority } = activity; - if (badge instanceof NumberBadge && activities.length > 1) { - const cumulativeNumberBadge = this.getCumulativeNumberBadge(activities, priority ?? 0); - activity = { badge: cumulativeNumberBadge }; - } - } - (this.action as CompositeBarAction).activity = activity; - } - - private getCumulativeNumberBadge(activityCache: IActivity[], priority: number): NumberBadge { - const numberActivities = activityCache.filter(activity => activity.badge instanceof NumberBadge && (activity.priority ?? 0) === priority); - const number = numberActivities.reduce((result, activity) => { return result + (activity.badge).number; }, 0); - const descriptorFn = (): string => { - return numberActivities.reduce((result, activity, index) => { - result = result + (activity.badge).getDescription(); - if (index < numberActivities.length - 1) { - result = `${result}\n`; - } - - return result; - }, ''); - }; - - return new NumberBadge(number, descriptorFn); - } - - override render(container: HTMLElement): void { - super.render(container); - - this._register(addDisposableListener(this.container, EventType.MOUSE_DOWN, async (e: MouseEvent) => { - EventHelper.stop(e, true); - const isLeftClick = e?.button !== 2; - // Left-click run - if (isLeftClick) { - this.run(); - } - })); - - // The rest of the activity bar uses context menu event for the context menu, so we match this - this._register(addDisposableListener(this.container, EventType.CONTEXT_MENU, async (e: MouseEvent) => { - const disposables = new DisposableStore(); - const actions = await this.resolveContextMenuActions(disposables); - - const event = new StandardMouseEvent(e); - - this.contextMenuService.showContextMenu({ - getAnchor: () => event, - getActions: () => actions, - onHide: () => disposables.dispose() - }); - })); - - this._register(addDisposableListener(this.container, EventType.KEY_UP, (e: KeyboardEvent) => { - const event = new StandardKeyboardEvent(e); - if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) { - EventHelper.stop(e, true); - this.run(); - } - })); - - this._register(addDisposableListener(this.container, TouchEventType.Tap, (e: GestureEvent) => { - EventHelper.stop(e, true); - this.run(); - })); - } - - protected async resolveContextMenuActions(disposables: DisposableStore): Promise { - return this.contextMenuActionsProvider(); - } - - private async run(): Promise { - const disposables = new DisposableStore(); - const menu = disposables.add(this.menuService.createMenu(this.menuId, this.contextKeyService)); - const actions = await this.resolveMainMenuActions(menu, disposables); - - this.contextMenuService.showContextMenu({ - getAnchor: () => this.label, - anchorAlignment: this.anchorAlignment, - anchorAxisAlignment: this.anchorAxisAlignment, - getActions: () => actions, - onHide: () => disposables.dispose(), - menuActionOptions: { renderShortTitle: true }, - }); - - } - - protected async resolveMainMenuActions(menu: IMenu, _disposable: DisposableStore): Promise { - const actions: IAction[] = []; - createAndFillInActionBarActions(menu, { renderShortTitle: true }, { primary: [], secondary: actions }); - return actions; - } -} - -export class AccountsActivityActionViewItem extends AbstractGlobalActivityActionViewItem { - - static readonly ACCOUNTS_VISIBILITY_PREFERENCE_KEY = 'workbench.activity.showAccounts'; - - private readonly groupedAccounts: Map = new Map(); - private readonly problematicProviders: Set = new Set(); - - private initialized = false; - private sessionFromEmbedder = new Lazy>(() => getCurrentAuthenticationSessionInfo(this.secretStorageService, this.productService)); - - constructor( - contextMenuActionsProvider: () => IAction[], - options: ICompositeBarActionViewItemOptions, - anchorAlignment: AnchorAlignment | undefined, - anchorAxisAlignment: AnchorAxisAlignment | undefined, - private readonly fillContextMenuActions: (actions: IAction[]) => void, - @IThemeService themeService: IThemeService, - @ILifecycleService private readonly lifecycleService: ILifecycleService, - @IHoverService hoverService: IHoverService, - @IContextMenuService contextMenuService: IContextMenuService, - @IMenuService menuService: IMenuService, - @IContextKeyService contextKeyService: IContextKeyService, - @IAuthenticationService private readonly authenticationService: IAuthenticationService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, - @IProductService private readonly productService: IProductService, - @IConfigurationService configurationService: IConfigurationService, - @IKeybindingService keybindingService: IKeybindingService, - @ISecretStorageService private readonly secretStorageService: ISecretStorageService, - @ILogService private readonly logService: ILogService, - @IActivityService activityService: IActivityService, - @IInstantiationService instantiationService: IInstantiationService, - ) { - const action = instantiationService.createInstance(CompositeBarAction, { - id: ACCOUNTS_ACTIVITY_ID, - name: localize('accounts', "Accounts"), - classNames: ThemeIcon.asClassNameArray(GlobalCompositeBar.ACCOUNTS_ICON) - }); - super(MenuId.AccountsContext, action, options, contextMenuActionsProvider, anchorAlignment, anchorAxisAlignment, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, keybindingService, activityService); - this._register(action); - this.registerListeners(); - this.initialize(); - } - - private registerListeners(): void { - this._register(this.authenticationService.onDidRegisterAuthenticationProvider(async (e) => { - await this.addAccountsFromProvider(e.id); - })); - - this._register(this.authenticationService.onDidUnregisterAuthenticationProvider((e) => { - this.groupedAccounts.delete(e.id); - this.problematicProviders.delete(e.id); - })); - - this._register(this.authenticationService.onDidChangeSessions(async e => { - for (const changed of [...e.event.changed, ...e.event.added]) { - try { - await this.addOrUpdateAccount(e.providerId, changed.account); - } catch (e) { - this.logService.error(e); - } - } - for (const removed of e.event.removed) { - this.removeAccount(e.providerId, removed.account); - } - })); - } - - // This function exists to ensure that the accounts are added for auth providers that had already been registered - // before the menu was created. - private async initialize(): Promise { - // Resolving the menu doesn't need to happen immediately, so we can wait until after the workbench has been restored - // and only run this when the system is idle. - await this.lifecycleService.when(LifecyclePhase.Restored); - if (this._store.isDisposed) { - return; - } - const disposable = this._register(runWhenIdle(async () => { - await this.doInitialize(); - disposable.dispose(); - })); - } - - private async doInitialize(): Promise { - const providerIds = this.authenticationService.getProviderIds(); - const results = await Promise.allSettled(providerIds.map(providerId => this.addAccountsFromProvider(providerId))); - - // Log any errors that occurred while initializing. We try to be best effort here to show the most amount of accounts - for (const result of results) { - if (result.status === 'rejected') { - this.logService.error(result.reason); - } - } - - this.initialized = true; - } - - //#region overrides - - protected override async resolveMainMenuActions(accountsMenu: IMenu, disposables: DisposableStore): Promise { - await super.resolveMainMenuActions(accountsMenu, disposables); - - const providers = this.authenticationService.getProviderIds(); - const otherCommands = accountsMenu.getActions(); - let menus: IAction[] = []; - - for (const providerId of providers) { - if (!this.initialized) { - const noAccountsAvailableAction = disposables.add(new Action('noAccountsAvailable', localize('loading', "Loading..."), undefined, false)); - menus.push(noAccountsAvailableAction); - break; - } - const providerLabel = this.authenticationService.getLabel(providerId); - const accounts = this.groupedAccounts.get(providerId); - if (!accounts) { - if (this.problematicProviders.has(providerId)) { - const providerUnavailableAction = disposables.add(new Action('providerUnavailable', localize('authProviderUnavailable', '{0} is currently unavailable', providerLabel), undefined, false)); - menus.push(providerUnavailableAction); - // try again in the background so that if the failure was intermittent, we can resolve it on the next showing of the menu - try { - await this.addAccountsFromProvider(providerId); - } catch (e) { - this.logService.error(e); - } - } - continue; - } - - for (const account of accounts) { - const manageExtensionsAction = disposables.add(new Action(`configureSessions${account.label}`, localize('manageTrustedExtensions', "Manage Trusted Extensions"), undefined, true, () => { - return this.authenticationService.manageTrustedExtensionsForAccount(providerId, account.label); - })); - - const providerSubMenuActions: Action[] = [manageExtensionsAction]; - - if (account.canSignOut) { - const signOutAction = disposables.add(new Action('signOut', localize('signOut', "Sign Out"), undefined, true, async () => { - const allSessions = await this.authenticationService.getSessions(providerId); - const sessionsForAccount = allSessions.filter(s => s.account.label === account.label); - return await this.authenticationService.removeAccountSessions(providerId, account.label, sessionsForAccount); - })); - providerSubMenuActions.push(signOutAction); - } - - const providerSubMenu = new SubmenuAction('activitybar.submenu', `${account.label} (${providerLabel})`, providerSubMenuActions); - menus.push(providerSubMenu); - } - } - - if (providers.length && !menus.length) { - const noAccountsAvailableAction = disposables.add(new Action('noAccountsAvailable', localize('noAccounts', "You are not signed in to any accounts"), undefined, false)); - menus.push(noAccountsAvailableAction); - } - - if (menus.length && otherCommands.length) { - menus.push(new Separator()); - } - - otherCommands.forEach((group, i) => { - const actions = group[1]; - menus = menus.concat(actions); - if (i !== otherCommands.length - 1) { - menus.push(new Separator()); - } - }); - - return menus; - } - - protected override async resolveContextMenuActions(disposables: DisposableStore): Promise { - const actions = await super.resolveContextMenuActions(disposables); - this.fillContextMenuActions(actions); - return actions; - } - - //#endregion - - //#region groupedAccounts helpers - - private async addOrUpdateAccount(providerId: string, account: AuthenticationSessionAccount): Promise { - let accounts = this.groupedAccounts.get(providerId); - if (!accounts) { - accounts = []; - this.groupedAccounts.set(providerId, accounts); - } - - const sessionFromEmbedder = await this.sessionFromEmbedder.value; - let canSignOut = true; - if ( - sessionFromEmbedder // if we have a session from the embedder - && !sessionFromEmbedder.canSignOut // and that session says we can't sign out - && (await this.authenticationService.getSessions(providerId)) // and that session is associated with the account we are adding/updating - .some(s => - s.id === sessionFromEmbedder.id - && s.account.id === account.id - ) - ) { - canSignOut = false; - } - - const existingAccount = accounts.find(a => a.label === account.label); - if (existingAccount) { - // if we have an existing account and we discover that we - // can't sign out of it, update the account to mark it as "can't sign out" - if (!canSignOut) { - existingAccount.canSignOut = canSignOut; - } - } else { - accounts.push({ ...account, canSignOut }); - } - } - - private removeAccount(providerId: string, account: AuthenticationSessionAccount): void { - const accounts = this.groupedAccounts.get(providerId); - if (!accounts) { - return; - } - - const index = accounts.findIndex(a => a.id === account.id); - if (index === -1) { - return; - } - - accounts.splice(index, 1); - if (accounts.length === 0) { - this.groupedAccounts.delete(providerId); - } - } - - private async addAccountsFromProvider(providerId: string): Promise { - try { - const sessions = await this.authenticationService.getSessions(providerId); - this.problematicProviders.delete(providerId); - - for (const session of sessions) { - try { - await this.addOrUpdateAccount(providerId, session.account); - } catch (e) { - this.logService.error(e); - } - } - } catch (e) { - this.logService.error(e); - this.problematicProviders.add(providerId); - } - } - - //#endregion -} - -export class GlobalActivityActionViewItem extends AbstractGlobalActivityActionViewItem { - - private profileBadge: HTMLElement | undefined; - private profileBadgeContent: HTMLElement | undefined; - - constructor( - contextMenuActionsProvider: () => IAction[], - options: ICompositeBarActionViewItemOptions, - anchorAlignment: AnchorAlignment | undefined, - anchorAxisAlignment: AnchorAxisAlignment | undefined, - @IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService, - @IThemeService themeService: IThemeService, - @IHoverService hoverService: IHoverService, - @IMenuService menuService: IMenuService, - @IContextMenuService contextMenuService: IContextMenuService, - @IContextKeyService contextKeyService: IContextKeyService, - @IConfigurationService configurationService: IConfigurationService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, - @IKeybindingService keybindingService: IKeybindingService, - @IInstantiationService instantiationService: IInstantiationService, - @IActivityService activityService: IActivityService, - ) { - const action = instantiationService.createInstance(CompositeBarAction, { - id: GLOBAL_ACTIVITY_ID, - name: localize('manage', "Manage"), - classNames: ThemeIcon.asClassNameArray(userDataProfileService.currentProfile.icon ? ThemeIcon.fromId(userDataProfileService.currentProfile.icon) : DEFAULT_ICON) - }); - super(MenuId.GlobalActivity, action, options, contextMenuActionsProvider, anchorAlignment, anchorAxisAlignment, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, keybindingService, activityService); - this._register(action); - this._register(this.userDataProfileService.onDidChangeCurrentProfile(e => { - action.compositeBarActionItem = { - ...action.compositeBarActionItem, - classNames: ThemeIcon.asClassNameArray(userDataProfileService.currentProfile.icon ? ThemeIcon.fromId(userDataProfileService.currentProfile.icon) : DEFAULT_ICON) - }; - })); - } - - override render(container: HTMLElement): void { - super.render(container); - - this.profileBadge = append(container, $('.profile-badge')); - this.profileBadgeContent = append(this.profileBadge, $('.profile-badge-content')); - this.updateProfileBadge(); - } - - private updateProfileBadge(): void { - if (!this.profileBadge || !this.profileBadgeContent) { - return; - } - - clearNode(this.profileBadgeContent); - hide(this.profileBadge); - - if (this.userDataProfileService.currentProfile.isDefault) { - return; - } - - if ((this.action as CompositeBarAction).activity) { - return; - } - - if (!this.userDataProfileService.currentProfile.icon || this.userDataProfileService.currentProfile.icon === DEFAULT_ICON.id) { - this.profileBadgeContent.classList.toggle('profile-text-overlay', true); - this.profileBadgeContent.classList.toggle('profile-icon-overlay', false); - this.profileBadgeContent.textContent = this.userDataProfileService.currentProfile.name.substring(0, 2).toUpperCase(); - } - - show(this.profileBadge); - } - - protected override updateActivity(): void { - super.updateActivity(); - this.updateProfileBadge(); - } - - protected override computeTitle(): string { - return this.userDataProfileService.currentProfile.isDefault ? super.computeTitle() : localize('manage profile', "Manage {0} (Profile)", this.userDataProfileService.currentProfile.name); - } -} - -export class SimpleAccountActivityActionViewItem extends AccountsActivityActionViewItem { - - constructor( - hoverOptions: IActivityHoverOptions, - @IThemeService themeService: IThemeService, - @ILifecycleService lifecycleService: ILifecycleService, - @IHoverService hoverService: IHoverService, - @IContextMenuService contextMenuService: IContextMenuService, - @IMenuService menuService: IMenuService, - @IContextKeyService contextKeyService: IContextKeyService, - @IAuthenticationService authenticationService: IAuthenticationService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, - @IProductService productService: IProductService, - @IConfigurationService configurationService: IConfigurationService, - @IKeybindingService keybindingService: IKeybindingService, - @ISecretStorageService secretStorageService: ISecretStorageService, - @ILogService logService: ILogService, - @IActivityService activityService: IActivityService, - @IInstantiationService instantiationService: IInstantiationService - ) { - super(() => [], { - colors: theme => ({ - badgeBackground: theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND), - badgeForeground: theme.getColor(ACTIVITY_BAR_BADGE_FOREGROUND), - }), - hoverOptions, - compact: true, - }, undefined, undefined, actions => actions, themeService, lifecycleService, hoverService, contextMenuService, menuService, contextKeyService, authenticationService, environmentService, productService, configurationService, keybindingService, secretStorageService, logService, activityService, instantiationService); - } -} - -export class SimpleGlobalActivityActionViewItem extends GlobalActivityActionViewItem { - - constructor( - hoverOptions: IActivityHoverOptions, - @IUserDataProfileService userDataProfileService: IUserDataProfileService, - @IThemeService themeService: IThemeService, - @IHoverService hoverService: IHoverService, - @IMenuService menuService: IMenuService, - @IContextMenuService contextMenuService: IContextMenuService, - @IContextKeyService contextKeyService: IContextKeyService, - @IConfigurationService configurationService: IConfigurationService, - @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, - @IKeybindingService keybindingService: IKeybindingService, - @IInstantiationService instantiationService: IInstantiationService, - @IActivityService activityService: IActivityService, - ) { - super(() => [], { - colors: theme => ({ - badgeBackground: theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND), - badgeForeground: theme.getColor(ACTIVITY_BAR_BADGE_FOREGROUND), - }), - hoverOptions, - compact: true, - }, undefined, undefined, userDataProfileService, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, environmentService, keybindingService, instantiationService, activityService); - } -} diff --git a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index 5960dfe27..ced29fa41 100644 --- a/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/vscode-web/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -361,9 +361,8 @@ color: white; } -/* Layout Controls */ -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container, -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .layout-controls-container { +/* Action Tool Bar Controls */ +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container { display: none; padding-right: 2px; flex-grow: 0; @@ -376,41 +375,38 @@ min-width: 28px; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .layout-controls-container { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container { margin-left: auto; } -.monaco-workbench.mac:not(.web) .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container, -.monaco-workbench.mac:not(.web) .part.titlebar > .titlebar-container > .titlebar-right > .layout-controls-container { +.monaco-workbench.mac:not(.web) .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container { right: 8px; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container:not(.has-no-actions), -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .layout-controls-container.show-layout-control { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container:not(.has-no-actions) { display: flex; justify-content: center; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .codicon, -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .layout-controls-container .codicon { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .codicon { color: inherit; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .action-item { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .action-item { display: flex; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .badge { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .badge { margin-left: 8px; display: flex; align-items: center; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .action-item.icon .badge { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .action-item.icon .badge { margin-left: 0px; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .badge .badge-content { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .badge .badge-content { padding: 3px 5px; border-radius: 11px; font-size: 9px; @@ -424,7 +420,7 @@ position: relative; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .action-item.icon .badge.compact { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .action-item.icon .badge.compact { position: absolute; top: 0; bottom: 0; @@ -436,13 +432,13 @@ z-index: 2; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .action-item.icon .badge.compact .badge-content::before { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .action-item.icon .badge.compact .badge-content::before { mask-size: 12px; -webkit-mask-size: 12px; top: 2px; } -.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .global-actions-container .monaco-action-bar .action-item.icon .badge.compact .badge-content { +.monaco-workbench .part.titlebar > .titlebar-container > .titlebar-right > .action-toolbar-container .monaco-action-bar .action-item.icon .badge.compact .badge-content { position: absolute; top: 10px; right: 0px; diff --git a/vscode-web/src/vs/workbench/browser/web.main.ts b/vscode-web/src/vs/workbench/browser/web.main.ts index 3647c78b5..fcc6a5ab1 100644 --- a/vscode-web/src/vs/workbench/browser/web.main.ts +++ b/vscode-web/src/vs/workbench/browser/web.main.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { mark } from 'vs/base/common/performance'; -import { domContentLoaded, detectFullscreen, getCookieValue } from 'vs/base/browser/dom'; +import { domContentLoaded, detectFullscreen, getCookieValue, getWindow } from 'vs/base/browser/dom'; import { assertIsDefined } from 'vs/base/common/types'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ILogService, ConsoleLogger, getLogLevel, ILoggerService, ILogger } from 'vs/platform/log/common/log'; @@ -32,7 +32,7 @@ import { WorkspaceService } from 'vs/workbench/services/configuration/browser/co import { ConfigurationCache } from 'vs/workbench/services/configuration/common/configurationCache'; import { ISignService } from 'vs/platform/sign/common/sign'; import { SignService } from 'vs/platform/sign/browser/signService'; -import { IWorkbenchConstructionOptions, IWorkbench, ITunnel } from 'vs/workbench/browser/web.api'; +import { IWorkbenchConstructionOptions, IWorkbench, IWorkspace, ITunnel } from 'vs/workbench/browser/web.api'; import { BrowserStorageService } from 'vs/workbench/services/storage/browser/storageService'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { toLocalISOString } from 'vs/base/common/date'; @@ -63,7 +63,6 @@ import { HTMLFileSystemProvider } from 'vs/platform/files/browser/htmlFileSystem import { IOpenerService } from 'vs/platform/opener/common/opener'; import { mixin, safeStringify } from 'vs/base/common/objects'; import { IndexedDB } from 'vs/base/browser/indexedDB'; -import { IWorkspace } from 'vs/workbench/services/host/browser/browserHostService'; import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IProgressService } from 'vs/platform/progress/common/progress'; @@ -95,6 +94,7 @@ import { EncryptionService } from 'vs/workbench/services/encryption/browser/encr import { IEncryptionService } from 'vs/platform/encryption/common/encryptionService'; import { ISecretStorageService } from 'vs/platform/secrets/common/secrets'; import { TunnelSource } from 'vs/workbench/services/remote/common/tunnelModel'; +import { mainWindow } from 'vs/base/browser/window'; export class BrowserMain extends Disposable { @@ -113,13 +113,13 @@ export class BrowserMain extends Disposable { private init(): void { // Browser config - setFullscreen(!!detectFullscreen()); + setFullscreen(!!detectFullscreen(mainWindow)); } async open(): Promise { // Init services and wait for DOM to be ready in parallel - const [services] = await Promise.all([this.initServices(), domContentLoaded()]); + const [services] = await Promise.all([this.initServices(), domContentLoaded(getWindow(this.domElement))]); // Create Workbench const workbench = new Workbench(this.domElement, undefined, services.serviceCollection, services.logService); @@ -467,7 +467,7 @@ export class BrowserMain extends Disposable { fileService.registerProvider(Schemas.vscodeUserData, userDataProvider); // Local file access (if supported by browser) - if (WebFileSystemAccess.supported(window)) { + if (WebFileSystemAccess.supported(mainWindow)) { fileService.registerProvider(Schemas.file, new HTMLFileSystemProvider(indexedDB, handlesStore, logService)); } @@ -578,7 +578,7 @@ export class BrowserMain extends Disposable { if (this.configuration.workspaceProvider) { workspace = this.configuration.workspaceProvider.workspace; } - + /* below codes are changed by github1s */ const id = window?.vscodeWeb?.workspaceId; diff --git a/vscode-web/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts b/vscode-web/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts index dc0c64119..2021f6cc6 100644 --- a/vscode-web/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts +++ b/vscode-web/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts @@ -93,7 +93,7 @@ export class FileEditorInput extends AbstractTextResourceEditorInput implements preferredContents: string | undefined, @IInstantiationService private readonly instantiationService: IInstantiationService, @ITextFileService textFileService: ITextFileService, - @ITextModelService private readonly textModelResolverService: ITextModelService, + @ITextModelService private readonly textModelService: ITextModelService, @ILabelService labelService: ILabelService, @IFileService fileService: IFileService, @IFilesConfigurationService filesConfigurationService: IFilesConfigurationService, @@ -220,6 +220,29 @@ export class FileEditorInput extends AbstractTextResourceEditorInput implements return this.preferredDescription; } + override getTitle(verbosity?: Verbosity): string { + let title = super.getTitle(verbosity); + + const preferredTitle = this.getPreferredTitle(); + if (preferredTitle) { + title = `${preferredTitle} (${title})`; + } + + return title; + } + + protected getPreferredTitle(): string | undefined { + if (this.preferredName && this.preferredDescription) { + return `${this.preferredName} ${this.preferredDescription}`; + } + + if (this.preferredName || this.preferredDescription) { + return this.preferredName ?? this.preferredDescription; + } + + return undefined; + } + getEncoding(): string | undefined { if (this.model) { return this.model.getEncoding(); @@ -351,7 +374,7 @@ export class FileEditorInput extends AbstractTextResourceEditorInput implements // resolve() ensures we are not creating model references for these kind of resources. // In addition we have a bit of payload to take into account (encoding, reload) that the text resolver does not handle yet. if (!this.cachedTextFileModelReference) { - this.cachedTextFileModelReference = await this.textModelResolverService.createModelReference(this.resource) as IReference; + this.cachedTextFileModelReference = await this.textModelService.createModelReference(this.resource) as IReference; } const model = this.cachedTextFileModelReference.object; diff --git a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html index 7fd5ba482..2992e555e 100644 --- a/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html +++ b/vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html @@ -124,7 +124,11 @@ } code { + font-family: var(--monaco-monospace-font); color: var(--vscode-textPreformat-foreground); + background-color: var(--vscode-textPreformat-background); + padding: 1px 3px; + border-radius: 4px; } blockquote { diff --git a/vscode-web/src/vs/workbench/services/editor/browser/editorResolverService.ts b/vscode-web/src/vs/workbench/services/editor/browser/editorResolverService.ts index f0f9c77a3..891542741 100644 --- a/vscode-web/src/vs/workbench/services/editor/browser/editorResolverService.ts +++ b/vscode-web/src/vs/workbench/services/editor/browser/editorResolverService.ts @@ -10,7 +10,7 @@ import { basename, extname, isEqual } from 'vs/base/common/resources'; import { URI } from 'vs/base/common/uri'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { EditorActivation, EditorResolution, IEditorOptions } from 'vs/platform/editor/common/editor'; -import { DEFAULT_EDITOR_ASSOCIATION, EditorResourceAccessor, EditorInputWithOptions, IResourceSideBySideEditorInput, isEditorInputWithOptions, isEditorInputWithOptionsAndGroup, isResourceDiffEditorInput, isResourceSideBySideEditorInput, isUntitledResourceEditorInput, isResourceMergeEditorInput, IUntypedEditorInput, SideBySideEditor } from 'vs/workbench/common/editor'; +import { DEFAULT_EDITOR_ASSOCIATION, EditorResourceAccessor, EditorInputWithOptions, IResourceSideBySideEditorInput, isEditorInputWithOptions, isEditorInputWithOptionsAndGroup, isResourceDiffEditorInput, isResourceSideBySideEditorInput, isUntitledResourceEditorInput, isResourceMergeEditorInput, IUntypedEditorInput, SideBySideEditor, isResourceDiffListEditorInput } from 'vs/workbench/common/editor'; import { EditorInput } from 'vs/workbench/common/editor/editorInput'; import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { Schemas } from 'vs/base/common/network'; @@ -263,7 +263,7 @@ export class EditorResolverService extends Disposable implements IEditorResolver return matchingAssociations.filter(association => allEditors.find(c => c.editorInfo.id === association.viewType)); } - private getAllUserAssociations(): EditorAssociations { + getAllUserAssociations(): EditorAssociations { const inspectedEditorAssociations = this.configurationService.inspect<{ [fileNamePattern: string]: string }>(editorsAssociationsSettingId) || {}; /* below codes are changed by github1s */ const defaultAssociations = inspectedEditorAssociations.defaultValue ?? {}; @@ -466,6 +466,15 @@ export class EditorResolverService extends Disposable implements IEditorResolver return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options }; } + // If it's a diff list editor we trigger the create diff list editor input + if (isResourceDiffListEditorInput(editor)) { + if (!selectedEditor.editorFactoryObject.createMultiDiffEditorInput) { + return; + } + const inputWithOptions = await selectedEditor.editorFactoryObject.createMultiDiffEditorInput(editor, group); + return { editor: inputWithOptions.editor, options: inputWithOptions.options ?? options }; + } + if (isResourceSideBySideEditorInput(editor)) { throw new Error(`Untyped side by side editor input not supported here.`); } diff --git a/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts b/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts index d1be888a0..d752251bd 100644 --- a/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts +++ b/vscode-web/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts @@ -15,6 +15,7 @@ import { IExtensionResourceLoaderService } from 'vs/platform/extensionResourceLo import { IProductService } from 'vs/platform/product/common/productService'; import { ITranslations, localizeManifest } from 'vs/platform/extensionManagement/common/extensionNls'; import { ILogService } from 'vs/platform/log/common/log'; +import { mainWindow } from 'vs/base/browser/window'; interface IBundledExtension { extensionPath: string; @@ -55,7 +56,7 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne bundledExtensions = [/*BUILD->INSERT_BUILTIN_EXTENSIONS*/]; } else { // Find builtin extensions by checking for DOM - const builtinExtensionsElement = document.getElementById('vscode-workbench-builtin-extensions'); + const builtinExtensionsElement = mainWindow.document.getElementById('vscode-workbench-builtin-extensions'); const builtinExtensionsElementAttribute = builtinExtensionsElement ? builtinExtensionsElement.getAttribute('data-settings') : undefined; if (builtinExtensionsElementAttribute) { try { diff --git a/yarn.lock b/yarn.lock index aa6261882..f22e596e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,10 +31,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@github1s/vscode-web@0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@github1s/vscode-web/-/vscode-web-0.15.0.tgz#9ad8fe6da1494edad649c07b27b12057f5b69655" - integrity sha512-lA9r2NnqJTUSaQuM7o41gYH61dSQnuC5U5oWpZAHrs+65bV/EFVfKn8LCT9t8g9kcj80xRSipvSUfktXccji/Q== +"@github1s/vscode-web@0.16.0": + version "0.16.0" + resolved "https://registry.yarnpkg.com/@github1s/vscode-web/-/vscode-web-0.16.0.tgz#61d7bd18add80ebcc08b5cfd844998435e373993" + integrity sha512-/UGDPD1JwIjc+l4DnuBNpBfhNGmUjB3DY/wYeJ7UNqZvp7oEVTPUdZWiQAE6A9adggbxCr/1yzRVHvpu+jS+Gg== dependencies: "@vscode/iconv-lite-umd" "0.7.0" "@vscode/vscode-languagedetection" "1.0.21"