@@ -189,6 +189,7 @@ function renderHoverParts(participant: ColorHoverParticipant | StandaloneColorPi
189
189
const widget = disposables . add ( new ColorPickerWidget ( context . fragment , model , editor . getOption ( EditorOption . pixelRatio ) , themeService , participant instanceof StandaloneColorPickerParticipant ) ) ;
190
190
context . setColorPicker ( widget ) ;
191
191
192
+ let editorUpdatedByColorPicker = false ;
192
193
let range = new Range ( colorHover . range . startLineNumber , colorHover . range . startColumn , colorHover . range . endLineNumber , colorHover . range . endColumn ) ;
193
194
if ( participant instanceof StandaloneColorPickerParticipant ) {
194
195
const color = hoverParts [ 0 ] . model . color ;
@@ -200,10 +201,21 @@ function renderHoverParts(participant: ColorHoverParticipant | StandaloneColorPi
200
201
} else {
201
202
disposables . add ( model . onColorFlushed ( async ( color : Color ) => {
202
203
await _updateColorPresentations ( editorModel , model , color , range , colorHover ) ;
204
+ editorUpdatedByColorPicker = true ;
203
205
range = _updateEditorModel ( editor , range , model , context ) ;
204
206
} ) ) ;
205
207
}
206
- disposables . add ( model . onDidChangeColor ( ( color : Color ) => { _updateColorPresentations ( editorModel , model , color , range , colorHover ) ; } ) ) ;
208
+ disposables . add ( model . onDidChangeColor ( ( color : Color ) => {
209
+ _updateColorPresentations ( editorModel , model , color , range , colorHover ) ;
210
+ } ) ) ;
211
+ disposables . add ( editor . onDidChangeModelContent ( ( e ) => {
212
+ if ( editorUpdatedByColorPicker ) {
213
+ editorUpdatedByColorPicker = false ;
214
+ } else {
215
+ context . hide ( ) ;
216
+ editor . focus ( ) ;
217
+ }
218
+ } ) ) ;
207
219
return disposables ;
208
220
}
209
221
0 commit comments