Skip to content

Commit

Permalink
feat: implement debug service override
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Mar 22, 2023
1 parent 8b3a1d8 commit efbb861
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ StandaloneServices.initialize({
})
```

Additionally, this library exposes 11 modules that include the vscode version of some services (with some glue to make it work with monaco):
Additionally, this library exposes 12 modules that include the vscode version of some services (with some glue to make it work with monaco):

- Notifications: `vscode/service-override/notifications`
- Dialogs: `vscode/service-override/dialogs`
Expand All @@ -63,6 +63,7 @@ Additionally, this library exposes 11 modules that include the vscode version of
- VSCode themes: `vscode/service-override/theme`
- Token classification: `vscode/service-override/tokenClassification`
- Audio cue: `vscode/service-override/audioCue`
- Debug: `vscode/service-override/debug`

Usage:

Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
"types": "./dist/audioCue.d.ts",
"default": "./dist/audioCue.js"
},
"./service-override/debug": {
"types": "./dist/debug.d.ts",
"default": "./dist/debug.js"
},
"./monaco": {
"types": "./dist/monaco.d.ts",
"default": "./dist/monaco.js"
Expand Down Expand Up @@ -129,6 +133,9 @@
"service-override/audioCue": [
"./dist/audioCue.d.ts"
],
"service-override/debug": [
"./dist/debug.d.ts"
],
"monaco": [
"./dist/monaco.d.ts"
],
Expand Down
1 change: 1 addition & 0 deletions rollup/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const input = {
snippets: './src/service-override/snippets.ts',
languages: './src/service-override/languages.ts',
audioCue: './src/service-override/audioCue.ts',
debug: './src/service-override/debug.ts',
monaco: './src/monaco'
}

Expand Down
1 change: 1 addition & 0 deletions rollup/rollup.types.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default rollup.defineConfig([
'./dist/types/src/service-override/snippets.d.ts',
'./dist/types/src/service-override/languages.d.ts',
'./dist/types/src/service-override/audioCue.d.ts',
'./dist/types/src/service-override/debug.d.ts',
'./dist/types/src/monaco.d.ts'
].map((input): rollup.RollupOptions => ({
input,
Expand Down
39 changes: 39 additions & 0 deletions src/service-override/debug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import '../polyfill'
import '../vscode-services/missing-services'
import { IEditorOverrideServices } from 'vs/editor/standalone/browser/standaloneServices'
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
import { IRawLanguageExtensionPoint } from 'vs/workbench/services/language/common/languageService'
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug'
import { DebugService } from 'vs/workbench/contrib/debug/browser/debugService'
import { LanguageFeaturesService } from 'vscode/vs/editor/common/services/languageFeaturesService'
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'
import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService'
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'
import { DebugToolBar } from 'vs/workbench/contrib/debug/browser/debugToolBar'
import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugContentProvider'
import getLayoutServiceOverride from './layout'
import { onServicesInitialized } from './tools'
import 'vs/workbench/contrib/debug/browser/debug.contribution'

function initialize (instantiationService: IInstantiationService) {
setTimeout(() => {
instantiationService.createInstance(DebugToolBar)
instantiationService.createInstance(DebugContentProvider)
})
}

export default function getServiceOverride (): IEditorOverrideServices {
onServicesInitialized(initialize)

return {
...getLayoutServiceOverride(),
[ILanguageFeaturesService.toString()]: new SyncDescriptor(LanguageFeaturesService), // To restore inlineValuesProvider
[IDebugService.toString()]: new SyncDescriptor(DebugService),
[IConfigurationResolverService.toString()]: new SyncDescriptor(ConfigurationResolverService)
}
}

export {
IRawLanguageExtensionPoint
}
1 change: 1 addition & 0 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export { ISnippetsService } from 'vs/workbench/contrib/snippets/browser/snippets
export { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'
export { IStorageService } from 'vs/platform/storage/common/storage'
export { IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService'
export { IDebugService } from 'vs/workbench/contrib/debug/common/debug'

export {
NotificationsFilter,
Expand Down
1 change: 1 addition & 0 deletions tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"src/service-override/snippets.ts",
"src/service-override/languages.ts",
"src/service-override/audioCue.ts",
"src/service-override/debug.ts",
"src/monaco.ts"
]
}

0 comments on commit efbb861

Please sign in to comment.