Skip to content

Commit

Permalink
feat: demonstrate view services
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed May 30, 2023
1 parent a3ca5f1 commit faa3898
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
16 changes: 13 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
</head>
<body>
<div id="app">
<h1>Editor</h1>
<div id="editor" class="editor"></div>
<button id="run">Run with debugger</button>
<div style="display: flex">
<div style="display: flex; flex: none; border: 1px solid var(--vscode-editorWidget-border); margin-right: 20px">
<div id="activityBar"></div>
<div id="sidebar" style="width: 500px"></div>
</div>
<div style="flex: 1">
<h1>Editor</h1>
<div id="editor" class="editor"></div>
<button id="run">Run with debugger</button>
</div>
</div>
<div id="panel" style="display: flex; flex: none; border: 1px solid var(--vscode-editorWidget-border); margin-right: 20px; height: 400px"></div>

<h1>Settings</h1>
<div id="settings-editor" class="editor"></div>
<h1>Keybindings</h1>
Expand Down
1 change: 1 addition & 0 deletions demo/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ while (variable < 5000) {

const settingsModelReference = await createModelReference(monaco.Uri.from({ scheme: 'user', path: '/settings.json' }), `{
"workbench.colorTheme": "Default Dark+",
"workbench.iconTheme": "vs-seti",
"editor.autoClosingBrackets": "languageDefined",
"editor.autoClosingQuotes": "languageDefined",
"editor.scrollBeyondLastLine": true,
Expand Down
8 changes: 8 additions & 0 deletions demo/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import getTextmateServiceOverride from 'vscode/service-override/textmate'
import getThemeServiceOverride from 'vscode/service-override/theme'
import getLanguagesServiceOverride from 'vscode/service-override/languages'
import getAudioCueServiceOverride from 'vscode/service-override/audioCue'
import getViewsServiceOverride, { createSidebarPart, createActivitybarPar, createPanelPart, registerCustomView, ViewContainerLocation } from 'vscode/service-override/views'
import getDebugServiceOverride from 'vscode/service-override/debug'
import getPreferencesServiceOverride from 'vscode/service-override/preferences'
import getSnippetServiceOverride from 'vscode/service-override/snippets'
Expand All @@ -27,6 +28,8 @@ import { createConfiguredEditor } from 'vscode/monaco'
import 'vscode/default-extensions/theme-defaults'
import 'vscode/default-extensions/javascript'
import 'vscode/default-extensions/json'
import 'vscode/default-extensions/theme-seti'
import 'vscode/default-extensions/references-view'
import * as vscode from 'vscode'

// Workers
Expand Down Expand Up @@ -127,10 +130,15 @@ await initializeMonacoService({
...getAudioCueServiceOverride(),
...getDebugServiceOverride(),
...getPreferencesServiceOverride(),
...getViewsServiceOverride(),
...getSnippetServiceOverride()
})
await initializeVscodeExtensions()

createSidebarPart(document.querySelector<HTMLDivElement>('#sidebar')!)
createActivitybarPar(document.querySelector<HTMLDivElement>('#activityBar')!)
createPanelPart(document.querySelector<HTMLDivElement>('#panel')!)

const debuggerExtension = {
name: 'debugger',
publisher: 'codingame',
Expand Down
2 changes: 1 addition & 1 deletion demo/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ body {

.editor {
width: 900px;
height: 400px;
height: 600px;
}
5 changes: 3 additions & 2 deletions demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ export default defineConfig({
'vscode', 'vscode/extensions', 'vscode/services', 'vscode/monaco', 'vscode/service-override/modelEditor',
'vscode/service-override/notifications', 'vscode/service-override/dialogs', 'vscode/service-override/configuration',
'vscode/service-override/keybindings', 'vscode/service-override/textmate', 'vscode/service-override/theme', 'vscode/service-override/languages',
'vscode/service-override/audioCue', 'vscode/service-override/debug',
'vscode/service-override/audioCue', 'vscode/service-override/views', 'vscode/service-override/debug',
'vscode/service-override/preferences', 'vscode/service-override/snippets', 'vscode/service-override/files',
'vscode/default-extensions/theme-defaults', 'vscode/default-extensions/javascript', 'vscode/default-extensions/json'
'vscode/default-extensions/theme-defaults', 'vscode/default-extensions/javascript', 'vscode/default-extensions/json', 'vscode/default-extensions/theme-seti',
'vscode/default-extensions/references-view'
]
},
server: {
Expand Down

0 comments on commit faa3898

Please sign in to comment.