Path: blob/main/extensions/copilot/src/extension/prompts/node/panel/terminalSelection.tsx
13405 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { BasePromptElementProps, PromptElement, PromptPiece, PromptSizing, UserMessage } from '@vscode/prompt-tsx';6import { ITerminalService } from '../../../../platform/terminal/common/terminalService';78export interface ProjectLabelsProps extends BasePromptElementProps { }910export class TerminalSelection extends PromptElement<ProjectLabelsProps, string> {11constructor(12props: ProjectLabelsProps,13@ITerminalService private readonly _terminalService: ITerminalService14) {15super(props);16}1718override async prepare(): Promise<string> {19return this._terminalService.terminalSelection;20}2122override render(state: string, sizing: PromptSizing): PromptPiece<any, any> | undefined {23if (state.trim().length === 0) {24return (<>25<UserMessage priority={this.props.priority}>26The active terminal has no selection.27</UserMessage >28</>);29}3031return (<>32<UserMessage priority={this.props.priority}>33The active terminal's selection:<br />34{state}35</UserMessage >36</>);37}38}394041