Skip to content

Commit

Permalink
Revert mode-switcher changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwriternr committed Sep 26, 2024
1 parent 9a16d07 commit f7816b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

/*
import * as vscode from 'vscode';
import * as uuid from 'uuid';
Expand Down Expand Up @@ -574,3 +576,4 @@ class DocumentManager {
return index + 2;
}
}
*/
52 changes: 1 addition & 51 deletions src/vs/workbench/contrib/aideAgent/browser/aideAgentViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { $, append } from '../../../../base/browser/dom.js';
import { ActionBar } from '../../../../base/browser/ui/actionbar/actionbar.js';
import { Action } from '../../../../base/common/actions.js';
import { CancellationToken } from '../../../../base/common/cancellation.js';
import { Emitter, Event } from '../../../../base/common/event.js';
import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
import { DisposableStore } from '../../../../base/common/lifecycle.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
Expand Down Expand Up @@ -37,47 +33,8 @@ interface IViewPaneState extends IChatViewState {
sessionId?: string;
}

class ModeSwitcher extends Disposable {
private _onChange = this._register(new Emitter<{ id: string | null; focus: boolean }>());
get onChange(): Event<{ id: string | null; focus: boolean }> { return this._onChange.event; }

private _currentId: string | null = null;
get currentId(): string | null { return this._currentId; }

private actions: Action[];
private actionbar: ActionBar;

constructor(container: HTMLElement) {
super();
const element = append(container, $('.mode-switcher'));
this.actions = [];
this.actionbar = this._register(new ActionBar(element));
}

push(id: string, label: string, tooltip: string): void {
const action = new Action(id, label, undefined, true, () => this.update(id, true));

action.tooltip = tooltip;

this.actions.push(action);
this.actionbar.push(action);

if (this.actions.length === 1) {
this.update(id);
}
}

private update(id: string, focus?: boolean): void {
this._currentId = id;
this._onChange.fire({ id, focus: !!focus });
this.actions.forEach(a => a.checked = a.id === id);
}
}

export const CHAT_SIDEBAR_PANEL_ID = 'workbench.panel.aideAgentSidebar';
export class ChatViewPane extends ViewPane {
private modeSwitcher!: ModeSwitcher;

private _widget!: ChatWidget;
get widget(): ChatWidget { return this._widget; }

Expand Down Expand Up @@ -181,13 +138,6 @@ export class ChatViewPane extends ViewPane {
try {
super.renderBody(parent);

this.modeSwitcher = this._register(new ModeSwitcher(parent));
this.modeSwitcher.push('edit', 'Edit', 'Edit code using the agent');
this.modeSwitcher.push('chat', 'Chat', 'Chat with the agent');
this.modeSwitcher.onChange(e => {
console.log('modeSwitcher.onChange', e);
});

const scopedInstantiationService = this._register(this.instantiationService.createChild(new ServiceCollection([IContextKeyService, this.scopedContextKeyService])));
const locationBasedColors = this.getLocationBasedColors();
this._widget = this._register(scopedInstantiationService.createInstance(
Expand Down
23 changes: 0 additions & 23 deletions src/vs/workbench/contrib/aideAgent/browser/media/aideAgent.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,6 @@
position: relative;
}

#workbench\.panel\.aideAgentSidebar .pane-body > .mode-switcher {
position: absolute;
top: 12px;
right: 16px;
z-index: 1;
}

#workbench\.panel\.aideAgentSidebar .pane-body > .mode-switcher > .monaco-action-bar > .actions-container {
gap: 4px;
}

#workbench\.panel\.aideAgentSidebar .pane-body > .mode-switcher > .monaco-action-bar > .actions-container > .action-item > .action-label {
font-size: 11px;
border-radius: 0;
color: var(--vscode-panelTitle-inactiveForeground);
text-transform: uppercase;
}

#workbench\.panel\.aideAgentSidebar .pane-body > .mode-switcher > .monaco-action-bar > .actions-container > .action-item > .action-label.checked {
border-bottom: 1px solid var(--vscode-panelTitle-activeBorder);
color: var(--vscode-panelTitle-activeForeground);
}

.interactive-list > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > .monaco-tl-row > .monaco-tl-twistie {
/* Hide twisties from chat tree rows, but not from nested trees within a chat response */
display: none !important;
Expand Down

0 comments on commit f7816b3

Please sign in to comment.