@@ -45,7 +45,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
45
45
private _lastLineRelativePosition : number ;
46
46
private _hoverOnLine : number ;
47
47
private _hoverOnColumn : number ;
48
- private _stickyRangeProjectedOnEditor : IRange ;
48
+ private _stickyRangeProjectedOnEditor : IRange | undefined ;
49
49
50
50
constructor (
51
51
private readonly _editor : ICodeEditor ,
@@ -61,7 +61,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
61
61
this . _lastLineRelativePosition = 0 ;
62
62
this . _hoverOnLine = - 1 ;
63
63
this . _hoverOnColumn = - 1 ;
64
- this . _stickyRangeProjectedOnEditor = { } as IRange ;
64
+ this . _stickyRangeProjectedOnEditor = undefined ;
65
65
this . _lineHeight = this . _editor . getOption ( EditorOption . lineHeight ) ;
66
66
this . _register ( this . _editor . onDidChangeConfiguration ( e => {
67
67
if ( e . hasChanged ( EditorOption . lineHeight ) ) {
@@ -87,7 +87,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
87
87
return ;
88
88
}
89
89
const targetMouseEvent = mouseEvent . target as unknown as CustomMouseEvent ;
90
- if ( targetMouseEvent . detail === 'editor.contrib.stickyScrollWidget' && targetMouseEvent . element . innerText === targetMouseEvent . element . innerHTML ) {
90
+ if ( targetMouseEvent . detail === this . getId ( ) && targetMouseEvent . element . innerText === targetMouseEvent . element . innerHTML ) {
91
91
const text = targetMouseEvent . element . innerText ;
92
92
if ( this . _hoverOnColumn === - 1 ) {
93
93
return ;
@@ -111,18 +111,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
111
111
return ;
112
112
}
113
113
if ( candidateDefinitions . length !== 0 ) {
114
- const lineToDecorate = this . getDomNode ( ) . getElementsByClassName ( `stickyLine${ lineNumber } ` ) [ 0 ] . children [ 0 ] as HTMLElement ;
115
- let childHTML : HTMLElement | undefined = undefined ;
116
- for ( const childElement of lineToDecorate . children ) {
117
- const childAsHTMLElement = childElement as HTMLElement ;
118
- if ( childAsHTMLElement . innerText === text ) {
119
- childHTML = childAsHTMLElement ;
120
- break ;
121
- }
122
- }
123
- if ( ! childHTML ) {
124
- return ;
125
- }
114
+ const childHTML : HTMLElement = targetMouseEvent . element ;
126
115
if ( currentHTMLChild !== childHTML ) {
127
116
sessionStore . clear ( ) ;
128
117
currentHTMLChild = childHTML ;
0 commit comments