From bebabb0b904ae4be0e60e27df3c5f43318acefaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Mon, 15 Apr 2024 11:17:32 +0200 Subject: [PATCH 1/4] fix: move action to contribution file --- ...on-from-service-file-to-contribution.patch | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 vscode-paches/0049-fix-move-action-from-service-file-to-contribution.patch diff --git a/vscode-paches/0049-fix-move-action-from-service-file-to-contribution.patch b/vscode-paches/0049-fix-move-action-from-service-file-to-contribution.patch new file mode 100644 index 00000000..3d5497f8 --- /dev/null +++ b/vscode-paches/0049-fix-move-action-from-service-file-to-contribution.patch @@ -0,0 +1,152 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= +Date: Mon, 15 Apr 2024 10:52:20 +0200 +Subject: [PATCH] fix: move action from service file to contribution + +--- + .../browser/gettingStarted.contribution.ts | 45 +++++++++++++++++- + .../browser/gettingStartedService.ts | 46 +------------------ + 2 files changed, 46 insertions(+), 45 deletions(-) + +diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts +index 66b9062611f..353af173d3f 100644 +--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts ++++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts +@@ -15,7 +15,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis + import { KeyCode } from 'vs/base/common/keyCodes'; + import { EditorPaneDescriptor, IEditorPaneRegistry } from 'vs/workbench/browser/editor'; + import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; +-import { IWalkthroughsService } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService'; ++import { IWalkthroughsService, hiddenEntriesConfigurationKey, walkthroughMetadataConfigurationKey } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService'; + import { GettingStartedEditorOptions, GettingStartedInput } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput'; + import { registerWorkbenchContribution2, WorkbenchPhase } from 'vs/workbench/common/contributions'; + import { ConfigurationScope, Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; +@@ -30,6 +30,8 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten + import { StartupPageEditorResolverContribution, StartupPageRunnerContribution } from 'vs/workbench/contrib/welcomeGettingStarted/browser/startupPage'; + import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput'; + import { Categories } from 'vs/platform/action/common/actionCommonCategories'; ++import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; ++import { Memento } from 'vs/workbench/common/memento'; + + export * as icons from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedIcons'; + +@@ -341,3 +343,44 @@ configurationRegistry.registerConfiguration({ + registerWorkbenchContribution2(WorkspacePlatformContribution.ID, WorkspacePlatformContribution, WorkbenchPhase.AfterRestored); + registerWorkbenchContribution2(StartupPageEditorResolverContribution.ID, StartupPageEditorResolverContribution, WorkbenchPhase.BlockRestore); + registerWorkbenchContribution2(StartupPageRunnerContribution.ID, StartupPageRunnerContribution, WorkbenchPhase.AfterRestored); ++ ++registerAction2(class extends Action2 { ++ constructor() { ++ super({ ++ id: 'resetGettingStartedProgress', ++ category: localize2('developer', "Developer"), ++ title: localize2('resetWelcomePageWalkthroughProgress', "Reset Welcome Page Walkthrough Progress"), ++ f1: true ++ }); ++ } ++ ++ run(accessor: ServicesAccessor) { ++ const gettingStartedService = accessor.get(IWalkthroughsService); ++ const storageService = accessor.get(IStorageService); ++ ++ storageService.store( ++ hiddenEntriesConfigurationKey, ++ JSON.stringify([]), ++ StorageScope.PROFILE, ++ StorageTarget.USER); ++ ++ storageService.store( ++ walkthroughMetadataConfigurationKey, ++ JSON.stringify([]), ++ StorageScope.PROFILE, ++ StorageTarget.USER); ++ ++ const memento = new Memento('gettingStartedService', accessor.get(IStorageService)); ++ const record = memento.getMemento(StorageScope.PROFILE, StorageTarget.USER); ++ for (const key in record) { ++ if (Object.prototype.hasOwnProperty.call(record, key)) { ++ try { ++ gettingStartedService.deprogressStep(key); ++ } catch (e) { ++ console.error(e); ++ } ++ } ++ } ++ memento.saveMemento(); ++ } ++}); +diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.ts +index ae62d18f2d0..5bf6ad46471 100644 +--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.ts ++++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.ts +@@ -3,11 +3,10 @@ + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +-import { createDecorator, IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; ++import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; + import { Emitter, Event } from 'vs/base/common/event'; + import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; + import { Memento } from 'vs/workbench/common/memento'; +-import { Action2, registerAction2 } from 'vs/platform/actions/common/actions'; + import { ICommandService } from 'vs/platform/commands/common/commands'; + import { ContextKeyExpr, ContextKeyExpression, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; + import { Disposable } from 'vs/base/common/lifecycle'; +@@ -28,7 +27,7 @@ import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/ + import { dirname } from 'vs/base/common/path'; + import { coalesce, flatten } from 'vs/base/common/arrays'; + import { IViewsService } from 'vs/workbench/services/views/common/viewsService'; +-import { localize, localize2 } from 'vs/nls'; ++import { localize } from 'vs/nls'; + import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; + import { checkGlobFileExists } from 'vs/workbench/services/extensions/common/workspaceContains'; + import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +@@ -668,45 +667,4 @@ const convertInternalMediaPathsToBrowserURIs = (path: string | { hc: string; hcL + } + }; + +-registerAction2(class extends Action2 { +- constructor() { +- super({ +- id: 'resetGettingStartedProgress', +- category: localize2('developer', "Developer"), +- title: localize2('resetWelcomePageWalkthroughProgress', "Reset Welcome Page Walkthrough Progress"), +- f1: true +- }); +- } +- +- run(accessor: ServicesAccessor) { +- const gettingStartedService = accessor.get(IWalkthroughsService); +- const storageService = accessor.get(IStorageService); +- +- storageService.store( +- hiddenEntriesConfigurationKey, +- JSON.stringify([]), +- StorageScope.PROFILE, +- StorageTarget.USER); +- +- storageService.store( +- walkthroughMetadataConfigurationKey, +- JSON.stringify([]), +- StorageScope.PROFILE, +- StorageTarget.USER); +- +- const memento = new Memento('gettingStartedService', accessor.get(IStorageService)); +- const record = memento.getMemento(StorageScope.PROFILE, StorageTarget.USER); +- for (const key in record) { +- if (Object.prototype.hasOwnProperty.call(record, key)) { +- try { +- gettingStartedService.deprogressStep(key); +- } catch (e) { +- console.error(e); +- } +- } +- } +- memento.saveMemento(); +- } +-}); +- + registerSingleton(IWalkthroughsService, WalkthroughsService, InstantiationType.Delayed); +-- +2.34.1 + From 1d25203a530bdebc55b3fc74c415d13706b1a356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Mon, 15 Apr 2024 11:18:02 +0200 Subject: [PATCH 2/4] feat: Split welcome and walkthrough contributions --- src/service-override/walkthrough.ts | 22 ++++++++++++++++++++++ src/service-override/welcome.ts | 16 ---------------- 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 src/service-override/walkthrough.ts diff --git a/src/service-override/walkthrough.ts b/src/service-override/walkthrough.ts new file mode 100644 index 00000000..2592c383 --- /dev/null +++ b/src/service-override/walkthrough.ts @@ -0,0 +1,22 @@ +import { IEditorOverrideServices } from 'vs/editor/standalone/browser/standaloneServices' +import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors' +import { IWalkthroughsService, WalkthroughsService } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService' +import 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution' +import 'vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution' +import svgAssets from 'vs/workbench/contrib/welcomeGettingStarted/common/media/*.svg' +import pngAssets from 'vs/workbench/contrib/welcomeGettingStarted/common/media/*.png' +import { FileAccess } from 'vs/base/common/network' +import { registerAssets } from '../assets' + +registerAssets(svgAssets) +registerAssets(pngAssets) + +FileAccess.registerModuleContentProvider('vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough', () => import('vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough')) +FileAccess.registerModuleContentProvider('vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker', () => import('vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker')) +FileAccess.registerModuleContentProvider('vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile', () => import('vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile')) + +export default function getServiceOverride (): IEditorOverrideServices { + return { + [IWalkthroughsService.toString()]: new SyncDescriptor(WalkthroughsService, [], true) + } +} diff --git a/src/service-override/welcome.ts b/src/service-override/welcome.ts index 84ee02d1..4dd52fe5 100644 --- a/src/service-override/welcome.ts +++ b/src/service-override/welcome.ts @@ -1,24 +1,8 @@ import { IEditorOverrideServices } from 'vs/editor/standalone/browser/standaloneServices' -import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors' -import { IWalkthroughsService, WalkthroughsService } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService' -import 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution' -import 'vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution' import 'vs/workbench/contrib/welcomeViews/common/viewsWelcome.contribution' import 'vs/workbench/contrib/welcomeViews/common/newFile.contribution' -import svgAssets from 'vs/workbench/contrib/welcomeGettingStarted/common/media/*.svg' -import pngAssets from 'vs/workbench/contrib/welcomeGettingStarted/common/media/*.png' -import { FileAccess } from 'vs/base/common/network' -import { registerAssets } from '../assets' - -registerAssets(svgAssets) -registerAssets(pngAssets) - -FileAccess.registerModuleContentProvider('vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough', () => import('vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough')) -FileAccess.registerModuleContentProvider('vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker', () => import('vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker')) -FileAccess.registerModuleContentProvider('vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile', () => import('vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile')) export default function getServiceOverride (): IEditorOverrideServices { return { - [IWalkthroughsService.toString()]: new SyncDescriptor(WalkthroughsService, [], true) } } From 5cb973aea44ed010b768c91d98f8fc9116855471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Mon, 15 Apr 2024 11:18:21 +0200 Subject: [PATCH 3/4] feat(demo): add new service override --- demo/package-lock.json | 29 +++++++++++++++++------------ demo/package.json | 1 + demo/src/setup.common.ts | 2 ++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/demo/package-lock.json b/demo/package-lock.json index 59e7a1c1..cefe7df1 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -157,6 +157,7 @@ "@codingame/monaco-vscode-view-status-bar-service-override": "file:../dist/service-override-view-status-bar", "@codingame/monaco-vscode-view-title-bar-service-override": "file:../dist/service-override-view-title-bar", "@codingame/monaco-vscode-views-service-override": "file:../dist/service-override-views", + "@codingame/monaco-vscode-walkthrough-service-override": "file:../dist/service-override-walkthrough", "@codingame/monaco-vscode-welcome-service-override": "file:../dist/service-override-welcome", "@codingame/monaco-vscode-workbench-service-override": "file:../dist/service-override-workbench", "@codingame/monaco-vscode-working-copy-service-override": "file:../dist/service-override-working-copy", @@ -975,13 +976,7 @@ "version": "0.0.0-semantic-release", "license": "MIT", "dependencies": { - "@codingame/monaco-vscode-base-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-environment-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-extensions-service-override": "0.0.0-semantic-release", "@codingame/monaco-vscode-files-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-host-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-layout-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-quickaccess-service-override": "0.0.0-semantic-release", "vscode": "npm:@codingame/monaco-vscode-api@^0.0.0-semantic-release" } }, @@ -990,13 +985,7 @@ "version": "0.0.0-semantic-release", "license": "MIT", "dependencies": { - "@codingame/monaco-vscode-base-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-environment-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-extensions-service-override": "0.0.0-semantic-release", "@codingame/monaco-vscode-files-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-host-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-layout-service-override": "0.0.0-semantic-release", - "@codingame/monaco-vscode-quickaccess-service-override": "0.0.0-semantic-release", "vscode": "npm:@codingame/monaco-vscode-api@^0.0.0-semantic-release" } }, @@ -1213,6 +1202,7 @@ } }, "../dist/service-override-secret-storage": { + "name": "@codingame/monaco-vscode-secret-storage-service-override", "version": "0.0.0-semantic-release", "license": "MIT", "dependencies": { @@ -1382,6 +1372,17 @@ "vscode": "npm:@codingame/monaco-vscode-api@^0.0.0-semantic-release" } }, + "../dist/service-override-walk-through": { + "extraneous": true + }, + "../dist/service-override-walkthrough": { + "name": "@codingame/monaco-vscode-walkthrough-service-override", + "version": "0.0.0-semantic-release", + "license": "MIT", + "dependencies": { + "vscode": "npm:@codingame/monaco-vscode-api@^0.0.0-semantic-release" + } + }, "../dist/service-override-welcome": { "name": "@codingame/monaco-vscode-welcome-service-override", "version": "0.0.0-semantic-release", @@ -2155,6 +2156,10 @@ "resolved": "../dist/service-override-views", "link": true }, + "node_modules/@codingame/monaco-vscode-walkthrough-service-override": { + "resolved": "../dist/service-override-walkthrough", + "link": true + }, "node_modules/@codingame/monaco-vscode-welcome-service-override": { "resolved": "../dist/service-override-welcome", "link": true diff --git a/demo/package.json b/demo/package.json index d0b38636..c4e8449d 100644 --- a/demo/package.json +++ b/demo/package.json @@ -177,6 +177,7 @@ "@codingame/monaco-vscode-view-title-bar-service-override": "file:../dist/service-override-view-title-bar", "@codingame/monaco-vscode-views-service-override": "file:../dist/service-override-views", "@codingame/monaco-vscode-welcome-service-override": "file:../dist/service-override-welcome", + "@codingame/monaco-vscode-walkthrough-service-override": "file:../dist/service-override-walkthrough", "@codingame/monaco-vscode-workbench-service-override": "file:../dist/service-override-workbench", "@codingame/monaco-vscode-working-copy-service-override": "file:../dist/service-override-working-copy", "@codingame/monaco-vscode-workspace-trust-service-override": "file:../dist/service-override-workspace-trust", diff --git a/demo/src/setup.common.ts b/demo/src/setup.common.ts index 348c63e6..7ffa4b52 100644 --- a/demo/src/setup.common.ts +++ b/demo/src/setup.common.ts @@ -38,6 +38,7 @@ import getTestingServiceOverride from '@codingame/monaco-vscode-testing-service- import getChatServiceOverride from '@codingame/monaco-vscode-chat-service-override' import getNotebookServiceOverride from '@codingame/monaco-vscode-notebook-service-override' import getWelcomeServiceOverride from '@codingame/monaco-vscode-welcome-service-override' +import getWalkThroughServiceOverride from '@codingame/monaco-vscode-walkthrough-service-override' import getUserDataSyncServiceOverride from '@codingame/monaco-vscode-user-data-sync-service-override' import getAiServiceOverride from '@codingame/monaco-vscode-ai-service-override' import getTaskServiceOverride from '@codingame/monaco-vscode-task-service-override' @@ -311,6 +312,7 @@ export const commonServices: IEditorOverrideServices = { ...getChatServiceOverride(), ...getNotebookServiceOverride(), ...getWelcomeServiceOverride(), + ...getWalkThroughServiceOverride(), ...getUserDataSyncServiceOverride(), ...getAiServiceOverride(), ...getTaskServiceOverride(), From d71d30f0a75b0175b9536f44d553a808586269e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= Date: Mon, 15 Apr 2024 11:18:33 +0200 Subject: [PATCH 4/4] doc: update README --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 91f4375b..0dbf2665 100644 --- a/README.md +++ b/README.md @@ -162,15 +162,15 @@ Additionally, several packages that include the VSCode version of some services - **Preferences**: `@codingame/monaco-vscode-preferences-service-override` - Allow to read and write preferences - **Output**: `@codingame/monaco-vscode-output-service-override` - - Output panel support. *Hint*: It only makes sense to enable it when *Views* service is used. + - Output panel support. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **Terminal**: `@codingame/monaco-vscode-terminal-service-override` - - Terminal panel support. *Hint*: It only makes sense to enable it when *Views* service is used. + - Terminal panel support. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **Search**: `@codingame/monaco-vscode-search-service-override` - - search panel support. *Hint*: It only makes sense to enable it when *Views* service is used. + - search panel support. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **Markers**: `@codingame/monaco-vscode-markers-service-override` - - It adds the problems panel tab. *Hint*: It only makes sense to enable it when *Views* service is used. + - It adds the problems panel tab. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **SCM**: `@codingame/monaco-vscode-scm-service-override` - - It adds the SCM API that can be used to implement source control. *Hint*: It only makes sense to enable it when *Views* service is used. + - It adds the SCM API that can be used to implement source control. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **Testing**: `@codingame/monaco-vscode-testing-service-override` - It adds the Tests API. *Hint*: It makes more sense to enable it when *Views* service is used. - **Language detection worker**: `@codingame/monaco-vscode-language-detection-worker-service-override` @@ -201,7 +201,9 @@ Additionally, several packages that include the VSCode version of some services - **Notebook**: `@codingame/monaco-vscode-notebook-service-override` - Support for Jupyter notebooks - **Welcome**: `@codingame/monaco-vscode-welcome-service-override` - - Support for welcome pages/components. *Hint*: It only makes sense to enable it when *Views* service is used. + - Support for [viewsWelcome contribution point](https://code.visualstudio.com/api/references/contribution-points#contributes.viewsWelcome). *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. +- **Walkthrough**: `@codingame/monaco-vscode-walkthrough-service-override` + - Getting Started page and support for [walkthrough contribution point](https://code.visualstudio.com/api/references/contribution-points#contributes.walkthroughs). *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **User data sync**: `@codingame/monaco-vscode-user-data-sync-service-override` - Support for user data sync. ⚠️ It can't really be used as it relies on a [closed source backend from microsoft](https://code.visualstudio.com/docs/editor/settings-sync#_can-i-use-a-different-backend-or-service-for-settings-sync) for the moment ⚠️ - **Ai**: `@codingame/monaco-vscode-ai-service-override` @@ -209,9 +211,9 @@ Additionally, several packages that include the VSCode version of some services - **Task**: `@codingame/monaco-vscode-task-service-override` - Task management - **Outline**: `@codingame/monaco-vscode-outline-service-override` - - Support for the outline view. *Hint*: It only makes sense to enable it when *Views* service is used. + - Support for the outline view. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **Timeline**: `@codingame/monaco-vscode-timeline-service-override` - - Support for the timeline view. *Hint*: It only makes sense to enable it when *Views* service is used. + - Support for the timeline view. *Hint*: It only makes sense to enable it when *Views* or *Workbench* service are used. - **Workbench**: `@codingame/monaco-vscode-workbench-service-override` - Allows to render the full workbench layout. Is exclusive with the `views` service. Do not use both services at the same time. - **Comments**