@@ -359,11 +359,14 @@ function isInlineDiffFriendly(mapping: LineRangeMapping): boolean {
359
359
export class InlineChatFileCreatePreviewWidget extends ZoneWidget {
360
360
361
361
private readonly _elements = h ( 'div.inline-chat-newfile-widget@domNode' , [
362
- h ( 'div.title.show-file-icons@title' ) ,
362
+ h ( 'div.title@title' , [
363
+ h ( 'span.name.show-file-icons@name' ) ,
364
+ h ( 'span.detail@detail' ) ,
365
+ ] ) ,
363
366
h ( 'div.editor@editor' ) ,
364
367
] ) ;
365
368
366
- private readonly _title : ResourceLabel ;
369
+ private readonly _name : ResourceLabel ;
367
370
private readonly _previewEditor : ICodeEditor ;
368
371
private readonly _previewModel = new MutableDisposable ( ) ;
369
372
private _dim : Dimension | undefined ;
@@ -379,7 +382,7 @@ export class InlineChatFileCreatePreviewWidget extends ZoneWidget {
379
382
super ( parentEditor , { showArrow : false , showFrame : false , isResizeable : false , isAccessible : true , showInHiddenAreas : true , ordinal : 10000 + 2 } ) ;
380
383
super . create ( ) ;
381
384
382
- this . _title = instaService . createInstance ( ResourceLabel , this . _elements . title , { supportIcons : true } ) ;
385
+ this . _name = instaService . createInstance ( ResourceLabel , this . _elements . name , { supportIcons : true } ) ;
383
386
384
387
const contributions = EditorExtensionsRegistry
385
388
. getEditorContributions ( )
@@ -412,7 +415,7 @@ export class InlineChatFileCreatePreviewWidget extends ZoneWidget {
412
415
}
413
416
414
417
override dispose ( ) : void {
415
- this . _title . dispose ( ) ;
418
+ this . _name . dispose ( ) ;
416
419
this . _previewEditor . dispose ( ) ;
417
420
this . _previewModel . dispose ( ) ;
418
421
super . dispose ( ) ;
@@ -428,15 +431,20 @@ export class InlineChatFileCreatePreviewWidget extends ZoneWidget {
428
431
429
432
showCreation ( where : Range , uri : URI , edits : TextEdit [ ] ) : void {
430
433
431
- this . _title . element . setFile ( uri , { fileKind : FileKind . FILE } ) ;
434
+ this . _name . element . setFile ( uri , { fileKind : FileKind . FILE } ) ;
435
+
432
436
const langSelection = this . _languageService . createByFilepathOrFirstLine ( uri , undefined ) ;
433
437
const model = this . _modelService . createModel ( '' , langSelection , undefined , true ) ;
434
438
model . applyEdits ( edits . map ( edit => EditOperation . replace ( Range . lift ( edit . range ) , edit . text ) ) ) ;
435
439
this . _previewModel . value = model ;
436
440
this . _previewEditor . setModel ( model ) ;
437
441
438
- const lines = Math . min ( 7 , model . getLineCount ( ) ) ;
439
- const lineHeightPadding = ( this . editor . getOption ( EditorOption . lineHeight ) / 12 ) /* padding-top/bottom*/ ;
442
+ const lineHeight = this . editor . getOption ( EditorOption . lineHeight ) ;
443
+ this . _elements . title . style . height = `${ lineHeight } px` ;
444
+ const maxLines = Math . max ( 4 , Math . floor ( ( this . editor . getLayoutInfo ( ) . height / lineHeight ) / .33 ) ) ;
445
+
446
+ const lines = Math . min ( maxLines , model . getLineCount ( ) ) ;
447
+ const lineHeightPadding = ( lineHeight / 12 ) /* padding-top/bottom*/ ;
440
448
441
449
442
450
super . show ( where , lines + 1 + lineHeightPadding ) ;
0 commit comments