Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build/next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ const commonResourcePatterns = [
// Tree-sitter queries
'vs/editor/common/languages/highlights/*.scm',
'vs/editor/common/languages/injections/*.scm',

// SVGs referenced from CSS (needed for transpile/dev builds where CSS is copied as-is)
'vs/workbench/browser/media/code-icon.svg',
'vs/workbench/browser/parts/editor/media/letterpress*.svg',
];

// Resources only needed for dev/transpile builds (these get bundled into the main
Expand Down
2 changes: 1 addition & 1 deletion extensions/esbuild-extension-common.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function resolveOptions(config: RunConfig, outdir: string): BuildOptions {
options.format = 'cjs';
options.mainFields = ['module', 'main'];
} else if (config.platform === 'browser') {
options.format = 'iife';
options.format = 'cjs';
options.mainFields = ['browser', 'module', 'main'];
options.alias = {
'path': 'path-browserify',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"watch-client": "npm run gulp watch-client",
"watch-clientd": "deemon npm run watch-client",
"kill-watch-clientd": "deemon --kill npm run watch-client",
"watch-client-transpile": "npx tsx build/next/index.ts transpile --watch",
"watch-client-transpile": "node build/next/index.ts transpile --watch",
"watch-client-transpiled": "deemon npm run watch-client-transpile",
"kill-watch-client-transpiled": "deemon --kill npm run watch-client-transpile",
"watch-extensions": "npm run gulp watch-extensions watch-extension-media",
Expand Down
19 changes: 9 additions & 10 deletions src/vs/workbench/api/browser/mainThreadPower.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Disposable, DisposableStore } from '../../../base/common/lifecycle.js';
import { Disposable } from '../../../base/common/lifecycle.js';
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
import { ExtHostContext, ExtHostPowerShape, MainContext, MainThreadPowerShape, PowerSaveBlockerType, PowerSystemIdleState, PowerThermalState } from '../common/extHost.protocol.js';
import { IPowerService } from '../../services/power/common/powerService.js';
Expand All @@ -12,7 +12,6 @@ import { IPowerService } from '../../services/power/common/powerService.js';
export class MainThreadPower extends Disposable implements MainThreadPowerShape {

private readonly proxy: ExtHostPowerShape;
private readonly disposables = this._register(new DisposableStore());

constructor(
extHostContext: IExtHostContext,
Expand All @@ -22,14 +21,14 @@ export class MainThreadPower extends Disposable implements MainThreadPowerShape
this.proxy = extHostContext.getProxy(ExtHostContext.ExtHostPower);

// Forward power events to extension host
this.powerService.onDidSuspend(this.proxy.$onDidSuspend, this.proxy, this.disposables);
this.powerService.onDidResume(this.proxy.$onDidResume, this.proxy, this.disposables);
this.powerService.onDidChangeOnBatteryPower(this.proxy.$onDidChangeOnBatteryPower, this.proxy, this.disposables);
this.powerService.onDidChangeThermalState((state: PowerThermalState) => this.proxy.$onDidChangeThermalState(state), this, this.disposables);
this.powerService.onDidChangeSpeedLimit(this.proxy.$onDidChangeSpeedLimit, this.proxy, this.disposables);
this.powerService.onWillShutdown(this.proxy.$onWillShutdown, this.proxy, this.disposables);
this.powerService.onDidLockScreen(this.proxy.$onDidLockScreen, this.proxy, this.disposables);
this.powerService.onDidUnlockScreen(this.proxy.$onDidUnlockScreen, this.proxy, this.disposables);
this._register(this.powerService.onDidSuspend(this.proxy.$onDidSuspend, this.proxy));
this._register(this.powerService.onDidResume(this.proxy.$onDidResume, this.proxy));
this._register(this.powerService.onDidChangeOnBatteryPower(this.proxy.$onDidChangeOnBatteryPower, this.proxy));
this._register(this.powerService.onDidChangeThermalState((state: PowerThermalState) => this.proxy.$onDidChangeThermalState(state), this));
this._register(this.powerService.onDidChangeSpeedLimit(this.proxy.$onDidChangeSpeedLimit, this.proxy));
this._register(this.powerService.onWillShutdown(this.proxy.$onWillShutdown, this.proxy));
this._register(this.powerService.onDidLockScreen(this.proxy.$onDidLockScreen, this.proxy));
this._register(this.powerService.onDidUnlockScreen(this.proxy.$onDidUnlockScreen, this.proxy));
}

async $getSystemIdleState(idleThreshold: number): Promise<PowerSystemIdleState> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
.monaco-modal-editor-block {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
/* z-index for modal editors: below dialogs, quick input, context views, hovers but above other things */
z-index: 2000;
/* z-index for modal editors: above titlebar (2500) but below dialogs (2575) */
z-index: 2550;
display: flex;
justify-content: center;
align-items: center;
Expand Down
55 changes: 38 additions & 17 deletions src/vs/workbench/browser/parts/editor/modalEditorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import './media/modalEditorPart.css';
import { $, addDisposableListener, append, EventHelper, EventType, isHTMLElement } from '../../../../base/browser/dom.js';
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
import { KeyCode } from '../../../../base/common/keyCodes.js';
import { Emitter, Event } from '../../../../base/common/event.js';
import { DisposableStore, MutableDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
import { MenuId } from '../../../../platform/actions/common/actions.js';
Expand All @@ -28,6 +29,7 @@ import { IHostService } from '../../../services/host/browser/host.js';
import { IWorkbenchLayoutService, Parts } from '../../../services/layout/browser/layoutService.js';
import { mainWindow } from '../../../../base/browser/window.js';
import { localize } from '../../../../nls.js';
import { CLOSE_MODAL_EDITOR_COMMAND_ID, MOVE_MODAL_EDITOR_TO_MAIN_COMMAND_ID, TOGGLE_MODAL_EDITOR_MAXIMIZED_COMMAND_ID } from './editorCommands.js';

const defaultModalEditorAllowableCommands = new Set([
'workbench.action.quit',
Expand All @@ -36,6 +38,9 @@ const defaultModalEditorAllowableCommands = new Set([
'workbench.action.closeAllEditors',
'workbench.action.files.save',
'workbench.action.files.saveAll',
CLOSE_MODAL_EDITOR_COMMAND_ID,
MOVE_MODAL_EDITOR_TO_MAIN_COMMAND_ID,
TOGGLE_MODAL_EDITOR_MAXIMIZED_COMMAND_ID
]);

export interface ICreateModalEditorPartResult {
Expand All @@ -60,7 +65,6 @@ export class ModalEditorPart {

// Create modal container
const modalElement = $('.monaco-modal-editor-block.dimmed');
modalElement.tabIndex = -1;
this.layoutService.mainContainer.appendChild(modalElement);
disposables.add(toDisposable(() => modalElement.remove()));

Expand All @@ -71,14 +75,15 @@ export class ModalEditorPart {
const editorPartContainer = $('.part.editor.modal-editor-part', {
role: 'dialog',
'aria-modal': 'true',
'aria-labelledby': titleId
'aria-labelledby': titleId,
tabIndex: -1
});
shadowElement.appendChild(editorPartContainer);

// Create header with title and close button
const headerElement = editorPartContainer.appendChild($('.modal-editor-header'));

// Title element (centered)
// Title element
const titleElement = append(headerElement, $('div.modal-editor-title'));
titleElement.id = titleId;
titleElement.textContent = '';
Expand All @@ -102,7 +107,7 @@ export class ModalEditorPart {
[IEditorService, modalEditorService]
)));

// Create toolbar driven by MenuId.ModalEditorTitle
// Create toolbar
disposables.add(scopedInstantiationService.createInstance(MenuWorkbenchToolBar, actionBarContainer, MenuId.ModalEditorTitle, {
hiddenItemStrategy: HiddenItemStrategy.NoHide,
menuOptions: { shouldForwardArgs: true }
Expand All @@ -118,23 +123,43 @@ export class ModalEditorPart {
editorPart.notifyActiveEditorChanged();
})));

// Handle close on click outside (on the dimmed background)
// Handle double-click on header to toggle maximize
disposables.add(addDisposableListener(headerElement, EventType.DBLCLICK, e => {
EventHelper.stop(e);

editorPart.toggleMaximized();
}));

// Guide focus back into the modal when clicking outside modal
disposables.add(addDisposableListener(modalElement, EventType.MOUSE_DOWN, e => {
if (e.target === modalElement) {
editorPart.close();
EventHelper.stop(e, true);

editorPartContainer.focus();
}
}));

// Block certain workbench commands from being dispatched while the modal is open
disposables.add(addDisposableListener(modalElement, EventType.KEY_DOWN, e => {
const event = new StandardKeyboardEvent(e);
const resolved = this.keybindingService.softDispatch(event, this.layoutService.mainContainer);
if (resolved.kind === ResultKind.KbFound && resolved.commandId) {
if (
resolved.commandId.startsWith('workbench.') &&
!defaultModalEditorAllowableCommands.has(resolved.commandId)
) {
EventHelper.stop(event, true);

// Close on Escape
if (event.equals(KeyCode.Escape)) {
EventHelper.stop(event, true);

editorPart.close();
}

// Prevent unsupported commands
else {
const resolved = this.keybindingService.softDispatch(event, this.layoutService.mainContainer);
if (resolved.kind === ResultKind.KbFound && resolved.commandId) {
if (
resolved.commandId.startsWith('workbench.') &&
!defaultModalEditorAllowableCommands.has(resolved.commandId)
) {
EventHelper.stop(event, true);
}
}
}
}));
Expand Down Expand Up @@ -168,10 +193,6 @@ export class ModalEditorPart {

height = Math.min(height, availableHeight); // Ensure the modal never exceeds available height (below the title bar)

// Shift the modal block below the title bar
modalElement.style.top = `${titleBarOffset}px`;
modalElement.style.height = `calc(100% - ${titleBarOffset}px)`;

editorPartContainer.style.width = `${width}px`;
editorPartContainer.style.height = `${height}px`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ function getSkipReasonMessage(skipReason: PromptFileSkipReason | undefined, erro
return nls.localize('status.typeDisabled', 'Disabled');
case 'all-hooks-disabled':
return nls.localize('status.allHooksDisabled', 'All hooks disabled via disableAllHooks');
case 'claude-hooks-disabled':
return nls.localize('status.claudeHooksDisabled', 'Claude hooks disabled via chat.useClaudeHooks setting');
default:
return errorMessage ?? nls.localize('status.unknownError', 'Unknown error');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SkipToolConfirmation extends ToolConfirmationAction {
}
}

class ConfigureToolsAction extends Action2 {
export class ConfigureToolsAction extends Action2 {
public static ID = 'workbench.action.chat.configureTools';

constructor() {
Expand Down
Loading
Loading