@@ -46,6 +46,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
46
46
private _hoverOnLine : number ;
47
47
private _hoverOnColumn : number ;
48
48
private _stickyRangeProjectedOnEditor : IRange | null ;
49
+ private _candidateDefinitionsLength : number ;
49
50
50
51
constructor (
51
52
private readonly _editor : ICodeEditor ,
@@ -62,6 +63,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
62
63
this . _hoverOnLine = - 1 ;
63
64
this . _hoverOnColumn = - 1 ;
64
65
this . _stickyRangeProjectedOnEditor = null ;
66
+ this . _candidateDefinitionsLength = - 1 ;
65
67
this . _lineHeight = this . _editor . getOption ( EditorOption . lineHeight ) ;
66
68
this . _register ( this . _editor . onDidChangeConfiguration ( e => {
67
69
if ( e . hasChanged ( EditorOption . lineHeight ) ) {
@@ -113,6 +115,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
113
115
return ;
114
116
}
115
117
if ( candidateDefinitions . length !== 0 ) {
118
+ this . _candidateDefinitionsLength = candidateDefinitions . length ;
116
119
const childHTML : HTMLElement = targetMouseEvent . element ;
117
120
if ( currentHTMLChild !== childHTML ) {
118
121
sessionStore . clear ( ) ;
@@ -140,16 +143,19 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
140
143
sessionStore . clear ( ) ;
141
144
} ) ) ;
142
145
linkGestureStore . add ( gesture . onExecute ( async e => {
143
- if ( this . _hoverOnLine !== - 1 ) {
144
- if ( e . hasTriggerModifier ) {
145
- // Control click
146
- this . _instaService . invokeFunction ( goToDefinitionWithLocation , e , this . _editor as IActiveCodeEditor , { uri : this . _editor . getModel ( ) ! . uri , range : this . _stickyRangeProjectedOnEditor } as Location ) ;
147
- } else {
148
- // Normal click
146
+ if ( ( e . target as unknown as CustomMouseEvent ) . detail !== this . getId ( ) ) {
147
+ return ;
148
+ }
149
+ if ( e . hasTriggerModifier ) {
150
+ // Control click
151
+ if ( this . _candidateDefinitionsLength > 1 ) {
149
152
this . _editor . revealPosition ( { lineNumber : this . _hoverOnLine , column : 1 } ) ;
150
153
}
154
+ this . _instaService . invokeFunction ( goToDefinitionWithLocation , e , this . _editor as IActiveCodeEditor , { uri : this . _editor . getModel ( ) ! . uri , range : this . _stickyRangeProjectedOnEditor } as Location ) ;
155
+ } else {
156
+ // Normal click
157
+ this . _editor . revealPosition ( { lineNumber : this . _hoverOnLine , column : 1 } ) ;
151
158
}
152
-
153
159
} ) ) ;
154
160
return linkGestureStore ;
155
161
}
0 commit comments