Skip to content

Commit 7609feb

Browse files
authoredMar 6, 2025
Merge pull request #259 from aws/jurredr/context-description-truncate
Jurredr/context description truncate
2 parents b3eeffa + b1be08c commit 7609feb

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed
 

‎src/components/chat-item/prompt-input/prompt-input-quick-pick-item.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface PromptInputQuickPickItemProps {
1212
export class PromptInputQuickPickItem {
1313
render: ExtendedHTMLElement;
1414
private readonly props: PromptInputQuickPickItemProps;
15+
1516
constructor (props: PromptInputQuickPickItemProps) {
1617
this.props = props;
1718
this.render = DomBuilder.getInstance().build({
@@ -52,7 +53,13 @@ export class PromptInputQuickPickItem {
5253
? [ {
5354
type: 'div',
5455
classNames: [ 'mynah-chat-command-selector-command-description' ],
55-
children: [ this.props.quickPickItem.description ]
56+
children: [ {
57+
type: 'span',
58+
children: [ this.props.quickPickItem.description.slice(0, Math.ceil(this.props.quickPickItem.description.length / 2)) ]
59+
}, {
60+
type: 'span',
61+
children: [ this.props.quickPickItem.description.slice(Math.ceil(this.props.quickPickItem.description.length / 2)) ]
62+
} ]
5663
} ]
5764
: []),
5865
...((this.props.quickPickItem.children != null) && this.props.quickPickItem.children.length > 0

‎src/styles/components/chat/_chat-command-selector.scss

+21
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,27 @@
123123
grid-row: 2;
124124
grid-column: 2;
125125
color: var(--mynah-color-text-weak);
126+
display: flex;
127+
width: 100%;
128+
overflow: hidden;
129+
justify-content: flex-start;
130+
131+
> span:first-child {
132+
overflow: hidden;
133+
text-overflow: ellipsis;
134+
white-space: pre;
135+
flex: 0 1 auto;
136+
text-align: left;
137+
}
138+
139+
> span:last-child {
140+
flex: 0 1 auto;
141+
white-space: pre;
142+
overflow: hidden;
143+
display: inline-flex;
144+
flex-flow: row nowrap;
145+
justify-content: flex-end;
146+
}
126147
}
127148
}
128149
}

0 commit comments

Comments
 (0)
Failed to load comments.