@@ -53,7 +53,7 @@ const TaskHeader = ({
5353 todos,
5454} : TaskHeaderProps ) => {
5555 const { t } = useTranslation ( )
56- const { apiConfiguration, currentTaskItem, clineMessages } = useExtensionState ( )
56+ const { apiConfiguration, currentTaskItem, clineMessages, taskTitlesEnabled = false } = useExtensionState ( )
5757 const { id : modelId , info : model } = useSelectedModel ( apiConfiguration )
5858 const [ isTaskExpanded , setIsTaskExpanded ] = useState ( false )
5959 const [ showLongRunningTaskMessage , setShowLongRunningTaskMessage ] = useState ( false )
@@ -102,16 +102,25 @@ const TaskHeader = ({
102102 } , [ currentTaskItem ?. id ] )
103103
104104 useEffect ( ( ) => {
105+ if ( ! taskTitlesEnabled ) {
106+ setIsEditingTitle ( false )
107+ return
108+ }
109+
105110 if ( isEditingTitle ) {
106111 skipBlurSubmitRef . current = false
107112 requestAnimationFrame ( ( ) => {
108113 titleInputRef . current ?. focus ( )
109114 titleInputRef . current ?. select ( )
110115 } )
111116 }
112- } , [ isEditingTitle ] )
117+ } , [ isEditingTitle , taskTitlesEnabled ] )
113118
114119 const submitTitle = useCallback ( ( ) => {
120+ if ( ! taskTitlesEnabled ) {
121+ return
122+ }
123+
115124 if ( ! currentTaskItem ) {
116125 setIsEditingTitle ( false )
117126 return
@@ -134,7 +143,7 @@ const TaskHeader = ({
134143 } )
135144
136145 setTitleInput ( trimmed )
137- } , [ currentTaskItem , titleInput ] )
146+ } , [ currentTaskItem , taskTitlesEnabled , titleInput ] )
138147
139148 useEffect ( ( ) => {
140149 if ( ! isEditingTitle ) {
@@ -143,15 +152,22 @@ const TaskHeader = ({
143152 } , [ isEditingTitle ] )
144153
145154 const handleTitleBlur = useCallback ( ( ) => {
155+ if ( ! taskTitlesEnabled ) {
156+ return
157+ }
146158 if ( skipBlurSubmitRef . current ) {
147159 skipBlurSubmitRef . current = false
148160 return
149161 }
150162 submitTitle ( )
151- } , [ submitTitle ] )
163+ } , [ submitTitle , taskTitlesEnabled ] )
152164
153165 const handleTitleKeyDown = useCallback (
154166 ( event : ReactKeyboardEvent < HTMLInputElement > ) => {
167+ if ( ! taskTitlesEnabled ) {
168+ return
169+ }
170+
155171 if ( event . key === "Enter" ) {
156172 event . preventDefault ( )
157173 skipBlurSubmitRef . current = true
@@ -163,7 +179,7 @@ const TaskHeader = ({
163179 setTitleInput ( currentTaskItem ?. title ?? "" )
164180 }
165181 } ,
166- [ currentTaskItem ?. title , submitTitle ] ,
182+ [ currentTaskItem ?. title , submitTitle , taskTitlesEnabled ] ,
167183 )
168184
169185 const textContainerRef = useRef < HTMLDivElement > ( null )
@@ -181,9 +197,13 @@ const TaskHeader = ({
181197 </ StandardTooltip >
182198 )
183199
184- const renderTitleSection = ( ) => {
185- if ( ! currentTaskItem ) {
186- return null
200+ const renderPrimaryValue = ( ) => {
201+ if ( ! taskTitlesEnabled || ! currentTaskItem ) {
202+ return (
203+ < div className = "truncate min-w-0" data-testid = "task-primary-text" >
204+ < Mention text = { task . text } />
205+ </ div >
206+ )
187207 }
188208
189209 if ( isEditingTitle ) {
@@ -203,17 +223,20 @@ const TaskHeader = ({
203223 }
204224
205225 const tooltipKey = currentTitle . length > 0 ? "chat:task.editTitle" : "chat:task.addTitle"
226+ const showTitle = currentTitle . length > 0
227+ const displayNode = showTitle ? (
228+ < span className = "truncate text-base font-semibold" data-testid = "task-title-text" >
229+ { currentTitle }
230+ </ span >
231+ ) : (
232+ < div className = "truncate min-w-0" data-testid = "task-title-text" >
233+ < Mention text = { task . text } />
234+ </ div >
235+ )
206236
207237 return (
208- < div className = "flex items-center gap-1 text-vscode-foreground" data-testid = "task-title-display" >
209- < span
210- className = { cn (
211- "text-base font-semibold truncate max-w-full" ,
212- currentTitle . length === 0 && "italic text-vscode-descriptionForeground font-normal" ,
213- ) }
214- data-testid = "task-title-text" >
215- { currentTitle || t ( "chat:task.titlePlaceholder" ) }
216- </ span >
238+ < div className = "flex items-center gap-1 min-w-0 text-vscode-foreground" data-testid = "task-title-display" >
239+ < div className = "min-w-0 flex-1" > { displayNode } </ div >
217240 < StandardTooltip content = { t ( tooltipKey ) } >
218241 < button
219242 type = "button"
@@ -233,6 +256,13 @@ const TaskHeader = ({
233256 )
234257 }
235258
259+ const renderCollapsedSummary = ( ) => (
260+ < div className = "flex items-baseline gap-1 min-w-0" >
261+ < span className = "font-bold shrink-0" > { t ( "chat:task.title" ) } </ span >
262+ < div className = "min-w-0 flex-1" > { renderPrimaryValue ( ) } </ div >
263+ </ div >
264+ )
265+
236266 const hasTodos = todos && Array . isArray ( todos ) && todos . length > 0
237267
238268 return (
@@ -279,15 +309,14 @@ const TaskHeader = ({
279309 } } >
280310 < div className = "flex justify-between items-start gap-0" >
281311 < div className = "flex flex-col grow min-w-0 gap-1" >
282- { renderTitleSection ( ) }
283312 < div className = "whitespace-nowrap overflow-hidden text-ellipsis grow min-w-0 select-none" >
284313 { isTaskExpanded ? (
285- < span className = "font-bold" > { t ( "chat:task.title" ) } </ span >
286- ) : (
287- < div className = "flex items-baseline gap-1" >
314+ < div className = "flex flex-col gap-1 min-w-0" >
288315 < span className = "font-bold" > { t ( "chat:task.title" ) } </ span >
289- < Mention text = { task . text } / >
316+ < div className = "min-w-0" > { renderPrimaryValue ( ) } </ div >
290317 </ div >
318+ ) : (
319+ renderCollapsedSummary ( )
291320 ) }
292321 </ div >
293322 </ div >
0 commit comments