Skip to content

Commit

Permalink
feat(demo): demo full workbench mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Feb 16, 2024
1 parent 186f2b9 commit f15c865
Show file tree
Hide file tree
Showing 25 changed files with 1,505 additions and 1,073 deletions.
62 changes: 0 additions & 62 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,6 @@
<link rel="icon" href="/favicon.ico" type="image/x-icon">
</head>
<body>
<div id="app">
<div id="workbench-container">
<div id="titleBar"></div>
<div id="banner"></div>
<div id="workbench-top">
<div style="display: flex; flex: none; border: 1px solid var(--vscode-editorWidget-border)">
<div id="activityBar"></div>
<div id="sidebar" style="width: 400px"></div>
<div id="auxiliaryBar-left" style="max-width: 300px"></div>
</div>
<div style="flex: 1; min-width: 0">
<h1>Editor</h1>
<div id="editors"></div>

<button id="run">Run with debugger</button>
<button id="filesystem">Attach filesystem</button>
<button id="customEditorPanel">Open custom editor panel</button>
<button id="clearStorage">Clear user data</button>
<br />
<button id="togglePanel">Toggle Panel</button>
<button id="toggleAuxiliary">Toggle Secondary Panel</button>
<br />
<label for="localeSelect">Language:</label>
<select id="localeSelect">
<option value="">English</option>
<option value="cs">Czech</option>
<option value="de">German</option>
<option value="es">Spanish</option>
<option value="fr">French</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="pl">Polish</option>
<option value="pt-br">Portuguese (Brazil)</option>
<option value="qps-ploc">Pseudo Language</option>
<option value="ru">Russian</option>
<option value="tr">Turkish</option>
<option value="zh-hans">Chinese (Simplified)</option>
<option value="zh-hant">Chinese (Traditional)</option>
</select>
</div>
<div style="display: flex; flex: none; border: 1px solid var(--vscode-editorWidget-border);">
<div id="sidebar-right" style="max-width: 500px"></div>
<div id="activityBar-right"></div>
<div id="auxiliaryBar" style="max-width: 300px"></div>
</div>
</div>

<div id="panel"></div>

<div id="statusBar"></div>
</div>

<h1>Settings<span id="settings-dirty"></span></h1>
<button id="settingsui">Open settings UI</button>
<button id="resetsettings">Reset settings</button>
<div id="settings-editor" class="standalone-editor"></div>
<h1>Keybindings<span id="keybindings-dirty"></span></h1>
<button id="keybindingsui">Open keybindings UI</button>
<button id="resetkeybindings">Reset keybindings</button>
<div id="keybindings-editor" class="standalone-editor"></div>
</div>
<script type="module" src="/src/loader.ts"></script>
</body>
</html>
84 changes: 53 additions & 31 deletions demo/package-lock.json

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

5 changes: 3 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"compile": "tsc",
"start": "NODE_OPTIONS=--experimental-import-meta-resolve vite --config vite.config.ts",
"start:debug": "vite --config vite.config.ts --debug --force",
"build": "tsc --noEmit && vite --config vite.config.ts build",
"build": "vite --config vite.config.ts build",
"build:github": "tsc --noEmit && vite --config vite.github-page.config.ts build && touch dist/.nojekyll",
"start:debugServer": "node --loader ts-node/esm src/debugServer.ts",
"start:extHostServer": "WEB_ENDPOINT_URL_TEMPLATE=http://localhost:5173/ vscode-ext-host-server --without-connection-token"
Expand All @@ -23,7 +23,7 @@
"@types/ws": "^8.5.10",
"ts-node": "^10.9.2",
"typescript": "~5.3.3",
"vite": "~5.0.12"
"vite": "~5.1.2"
},
"dependencies": {
"@codingame/monaco-vscode-accessibility-service-override": "file:../dist/service-override-accessibility",
Expand Down Expand Up @@ -162,6 +162,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-workbench-service-override": "file:../dist/service-override-workbench",
"@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",
Expand Down
29 changes: 15 additions & 14 deletions demo/src/features/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ const { getApi } = registerExtension({
enabledApiProposals: ['aiRelatedInformation']
}, ExtensionHostKind.LocalProcess)

const vscode = await getApi()
vscode.commands.registerCommand('aiSuggestedCommand', () => {
void vscode.window.showInformationMessage('Hello', {
detail: 'You just run the AI suggested command',
modal: true
void getApi().then(async vscode => {
vscode.commands.registerCommand('aiSuggestedCommand', () => {
void vscode.window.showInformationMessage('Hello', {
detail: 'You just run the AI suggested command',
modal: true
})
})
vscode.ai.registerRelatedInformationProvider(vscode.RelatedInformationType.CommandInformation, {
provideRelatedInformation () {
return [{
type: vscode.RelatedInformationType.CommandInformation,
command: 'aiSuggestedCommand',
weight: 9999
}]
}
})
})
vscode.ai.registerRelatedInformationProvider(vscode.RelatedInformationType.CommandInformation, {
provideRelatedInformation () {
return [{
type: vscode.RelatedInformationType.CommandInformation,
command: 'aiSuggestedCommand',
weight: 9999
}]
}
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IDialogService, EditorInput, ITelemetryService, IThemeService, IStorageService, createInstance, IInstantiationService } from 'vscode/services'
import { registerCustomView, registerEditorPane, registerEditor, registerEditorSerializer, ViewContainerLocation, SimpleEditorPane, SimpleEditorInput, RegisteredEditorPriority, IEditorCloseHandler, ConfirmResult, IEditorSerializer } from '@codingame/monaco-vscode-views-service-override'
import { IEditorCloseHandler, IEditorSerializer, registerCustomView, registerEditorPane, registerEditor, registerEditorSerializer, ViewContainerLocation, SimpleEditorPane, SimpleEditorInput, RegisteredEditorPriority, ConfirmResult } from '@codingame/monaco-vscode-views-service-override'
import * as monaco from 'monaco-editor'

registerCustomView({
Expand Down Expand Up @@ -82,7 +82,7 @@ class CustomEditorInput extends SimpleEditorInput implements IEditorCloseHandler
this.setName('Custom editor pane input')
}

async confirm (): Promise<ConfirmResult> {
async confirm (): Promise<number> {
const { confirmed } = await this.dialogService.confirm({
message: 'Are you sure you want to close this INCREDIBLE editor pane?'
})
Expand Down
Loading

0 comments on commit f15c865

Please sign in to comment.