@@ -212,6 +212,12 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
212
212
return this . hide ( ) ;
213
213
}
214
214
215
+ const hasTextFocus = this . _editor . hasTextFocus ( ) ;
216
+ if ( ! hasTextFocus ) {
217
+ this . gutterHide ( ) ;
218
+ return this . hide ( ) ;
219
+ }
220
+
215
221
const options = this . _editor . getOptions ( ) ;
216
222
if ( ! options . get ( EditorOption . lightbulb ) . enabled ) {
217
223
this . gutterHide ( ) ;
@@ -236,6 +242,18 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
236
242
return lineNumber > 2 && this . _editor . getTopForLineNumber ( lineNumber ) === this . _editor . getTopForLineNumber ( lineNumber - 1 ) ;
237
243
} ;
238
244
245
+ // Check for glyph margin decorations of any kind
246
+ const currLineDecorations = this . _editor . getLineDecorations ( lineNumber ) ;
247
+ let hasDecoration = false ;
248
+ if ( currLineDecorations ) {
249
+ for ( const decoration of currLineDecorations ) {
250
+ if ( decoration . options . glyphMarginClassName ) {
251
+ hasDecoration = true ;
252
+ break ;
253
+ }
254
+ }
255
+ }
256
+
239
257
let effectiveLineNumber = lineNumber ;
240
258
let effectiveColumnNumber = 1 ;
241
259
if ( ! lineHasSpace ) {
@@ -253,8 +271,6 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
253
271
const currLineEmptyOrIndented = isLineEmptyOrIndented ( lineNumber ) ;
254
272
const notEmpty = ! nextLineEmptyOrIndented && ! prevLineEmptyOrIndented ;
255
273
256
- const currLineDecorations = this . _editor . getLineDecorations ( lineNumber ) ;
257
- const hasDecoration = ! ! ( currLineDecorations ?. length ) ;
258
274
259
275
// check above and below. if both are blocked, display lightbulb in the gutter.
260
276
if ( ! nextLineEmptyOrIndented && ! prevLineEmptyOrIndented && ! hasDecoration ) {
@@ -275,8 +291,13 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
275
291
position : { lineNumber : effectiveLineNumber , column : effectiveColumnNumber } ,
276
292
preference : LightBulbWidget . _posPref
277
293
} ) ;
278
- this . renderGutterLightbub ( ) ;
279
- return this . hide ( ) ;
294
+
295
+ if ( hasDecoration ) {
296
+ this . gutterHide ( ) ;
297
+ } else {
298
+ this . renderGutterLightbub ( ) ;
299
+ return this . hide ( ) ;
300
+ }
280
301
} else if ( ( lineNumber < model . getLineCount ( ) ) && ! isFolded ( lineNumber + 1 ) ) {
281
302
effectiveLineNumber += 1 ;
282
303
} else if ( column * fontInfo . spaceWidth < 22 ) {
0 commit comments