Skip to content

Commit

Permalink
Merge pull request #278 from CompuIves/feat/add-extension-services
Browse files Browse the repository at this point in the history
feat: add extension url and authentication service
  • Loading branch information
CGNonofr authored Dec 4, 2023
2 parents db70656 + 5148861 commit 355191b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
14 changes: 14 additions & 0 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@codingame/monaco-vscode-log-service-override": "file:../dist/service-override-log",
"@codingame/monaco-vscode-accessibility-service-override": "file:../dist/service-override-accessibility",
"@codingame/monaco-vscode-audio-cue-service-override": "file:../dist/service-override-audio-cue",
"@codingame/monaco-vscode-authentication-service-override": "file:../dist/service-override-authentication",
"@codingame/monaco-vscode-bat-default-extension": "file:../dist/default-extension-bat",
"@codingame/monaco-vscode-bulk-edit-service-override": "file:../dist/service-override-bulk-edit",
"@codingame/monaco-vscode-clojure-default-extension": "file:../dist/default-extension-clojure",
Expand Down
2 changes: 2 additions & 0 deletions demo/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import getKeybindingsServiceOverride, { initUserKeybindings } from '@codingame/m
import getTextmateServiceOverride from '@codingame/monaco-vscode-textmate-service-override'
import getThemeServiceOverride from '@codingame/monaco-vscode-theme-service-override'
import getLanguagesServiceOverride from '@codingame/monaco-vscode-languages-service-override'
import getAuthenticationServiceOverride from '@codingame/monaco-vscode-authentication-service-override'
import getAudioCueServiceOverride from '@codingame/monaco-vscode-audio-cue-service-override'
import getExtensionGalleryServiceOverride from '@codingame/monaco-vscode-extension-gallery-service-override'
import getViewsServiceOverride, {
Expand Down Expand Up @@ -92,6 +93,7 @@ await Promise.all([

// Override services
await initializeMonacoService({
...getAuthenticationServiceOverride(),
...getLogServiceOverride(),
...getExtensionServiceOverride(workerConfig),
...getExtensionGalleryServiceOverride({ webOnly: false }),
Expand Down
13 changes: 13 additions & 0 deletions scripts/vscode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,19 @@ index 25885c7c4f9..2d220cbe1ad 100644
+
+
+registerSingleton(IExtensionService, BrowserExtensionService, InstantiationType.Eager);
diff --git a/src/vs/workbench/services/extensions/browser/extensionUrlHandler.ts b/src/vs/workbench/services/extensions/browser/extensionUrlHandler.ts
index 9da3a6e5c58..dce278df3bb 100644
--- a/src/vs/workbench/services/extensions/browser/extensionUrlHandler.ts
+++ b/src/vs/workbench/services/extensions/browser/extensionUrlHandler.ts
@@ -99,7 +99,7 @@ type ExtensionUrlHandlerClassification = {
*
* It also makes sure the user confirms opening URLs directed towards extensions.
*/
-class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler {
+export class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler {

readonly _serviceBrand: undefined;

diff --git a/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts b/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts
index a7ce017ab9f..fd873470224 100644
--- a/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.ts
Expand Down
10 changes: 10 additions & 0 deletions src/service-override/authentication.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { IEditorOverrideServices } from 'vs/editor/standalone/browser/standaloneServices'
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
import { IAuthenticationService } from 'vs/workbench/services/authentication/common/authentication'
import { AuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService'

export default function getServiceOverride (): IEditorOverrideServices {
return {
[IAuthenticationService.toString()]: new SyncDescriptor(AuthenticationService, [], true)
}
}
6 changes: 4 additions & 2 deletions src/service-override/extensionGallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import { ExtensionTipsService } from 'vs/platform/extensionManagement/common/ext
import { ExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/extensionManagementService'
import { IRemoteUserDataProfilesService, RemoteUserDataProfilesService } from 'vs/workbench/services/userDataProfile/common/remoteUserDataProfiles'
import { ExtensionEnablementService } from 'vs/workbench/services/extensionManagement/browser/extensionEnablementService'
import { IInstantiationService, ILabelService, IRemoteAgentService } from '../services'
import 'vs/workbench/contrib/extensions/browser/extensions.contribution'
import 'vs/workbench/contrib/extensions/browser/extensions.web.contribution'
import { ExtensionUrlHandler, IExtensionUrlHandler } from 'vs/workbench/services/extensions/browser/extensionUrlHandler'
import { IInstantiationService, ILabelService, IRemoteAgentService } from '../services'
import { registerAssets } from '../assets'

// plugin-import-meta-asset only allows relative paths
Expand Down Expand Up @@ -82,6 +83,7 @@ export default function getServiceOverride (options: ExtensionGalleryOptions = {
[IRemoteExtensionsScannerService.toString()]: new SyncDescriptor(RemoteExtensionsScannerService, [], true),
[IExtensionTipsService.toString()]: new SyncDescriptor(ExtensionTipsService, [], true),
[IRemoteUserDataProfilesService.toString()]: new SyncDescriptor(RemoteUserDataProfilesService, [], true),
[IWorkbenchExtensionEnablementService.toString()]: new SyncDescriptor(ExtensionEnablementService, [], true)
[IWorkbenchExtensionEnablementService.toString()]: new SyncDescriptor(ExtensionEnablementService, [], true),
[IExtensionUrlHandler.toString()]: new SyncDescriptor(ExtensionUrlHandler, [], true)
}
}

0 comments on commit 355191b

Please sign in to comment.