@@ -19,6 +19,9 @@ import { Range } from '../../../../editor/common/core/range.js';
19
19
import { Codicon } from '../../../../base/common/codicons.js' ;
20
20
import { ThemeIcon } from '../../../../base/common/themables.js' ;
21
21
import { ChatEditorController } from './chatEditorController.js' ;
22
+ import { IViewsService } from '../../../services/views/common/viewsService.js' ;
23
+ import { EDITS_VIEW_ID } from './chat.js' ;
24
+ import { ActionViewItem } from '../../../../base/browser/ui/actionbar/actionViewItems.js' ;
22
25
23
26
class ChatEditorOverlayWidget implements IOverlayWidget {
24
27
@@ -33,20 +36,21 @@ class ChatEditorOverlayWidget implements IOverlayWidget {
33
36
constructor (
34
37
private readonly _editor : ICodeEditor ,
35
38
@IEditorService private readonly _editorService : IEditorService ,
39
+ @IViewsService private readonly _viewsService : IViewsService ,
36
40
@IInstantiationService instaService : IInstantiationService ,
37
41
) {
38
42
this . _domNode = document . createElement ( 'div' ) ;
39
43
this . _domNode . classList . add ( 'chat-editor-overlay-widget' ) ;
40
44
41
- const progressNode = document . createElement ( 'div' ) ;
42
- progressNode . classList . add ( 'progress-container' ) ;
43
- progressNode . classList . add ( ... ThemeIcon . asClassNameArray ( ThemeIcon . modify ( Codicon . loading , 'spin' ) ) ) ;
44
- this . _domNode . appendChild ( progressNode ) ;
45
-
46
- const toolbarContainer = document . createElement ( 'div' ) ;
47
- toolbarContainer . classList . add ( 'toolbar-container' ) ;
48
- this . _domNode . appendChild ( toolbarContainer ) ;
49
- this . _toolbar = instaService . createInstance ( WorkbenchToolBar , toolbarContainer , { } ) ;
45
+ this . _toolbar = instaService . createInstance ( WorkbenchToolBar , this . _domNode , {
46
+ telemetrySource : 'chatEditor.overlayToolbar' ,
47
+ actionViewItemProvider : ( action , options ) => {
48
+ if ( action . id === 'accept' || action . id === 'discard' ) {
49
+ return new ActionViewItem ( undefined , action , { ... options , label : true , icon : false } ) ;
50
+ }
51
+ return undefined ;
52
+ }
53
+ } ) ;
50
54
}
51
55
52
56
dispose ( ) {
@@ -104,9 +108,20 @@ class ChatEditorOverlayWidget implements IOverlayWidget {
104
108
this . _domNode . classList . toggle ( 'busy' , busy ) ;
105
109
106
110
const groups = [ [
111
+ toAction ( {
112
+ id : 'open' ,
113
+ label : localize ( 'open' , 'Open Chat Edit' ) ,
114
+ class : ThemeIcon . asClassName ( busy
115
+ ? ThemeIcon . modify ( Codicon . loading , 'spin' )
116
+ : Codicon . goToEditingSession ) ,
117
+ run : async ( ) => {
118
+ await this . _viewsService . openView ( EDITS_VIEW_ID ) ;
119
+ }
120
+ } ) ,
107
121
toAction ( {
108
122
id : 'accept' ,
109
- label : localize ( 'accept' , 'Accept Chat Edits' ) ,
123
+ label : localize ( 'accept' , 'Accept' ) ,
124
+ tooltip : localize ( 'acceptTooltip' , 'Accept Chat Edits' ) ,
110
125
class : ThemeIcon . asClassName ( Codicon . check ) ,
111
126
enabled : ! busy && modified ,
112
127
run : ( ) => {
@@ -116,7 +131,8 @@ class ChatEditorOverlayWidget implements IOverlayWidget {
116
131
} ) ,
117
132
toAction ( {
118
133
id : 'discard' ,
119
- label : localize ( 'discard' , 'Discard Chat Edits' ) ,
134
+ label : localize ( 'discard' , 'Discard' ) ,
135
+ tooltip : localize ( 'discardTooltip' , 'Discard Chat Edits' ) ,
120
136
class : ThemeIcon . asClassName ( Codicon . discard ) ,
121
137
enabled : ! busy && modified ,
122
138
run : ( ) => {
0 commit comments