Skip to content

Commit a38a941

Browse files
author
aiday-mar
committed
Inside onExecute checking the target.detail entry of the event
1 parent 93a571a commit a38a941

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,21 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
143143
sessionStore.clear();
144144
}));
145145
linkGestureStore.add(gesture.onExecute(async e => {
146-
if (this._hoverOnLine !== -1) {
147-
if (e.hasTriggerModifier) {
148-
// Control click
149-
if (this._candidateDefinitionsLength === 1) {
150-
this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor } as Location);
151-
} else {
152-
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
153-
this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor } as Location);
154-
}
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) {
152+
this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor } as Location);
155153
} else {
156-
// Normal click
157154
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
155+
this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor } as Location);
158156
}
159-
this._hoverOnLine = -1;
157+
} else {
158+
// Normal click
159+
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
160160
}
161-
162161
}));
163162
return linkGestureStore;
164163
}
@@ -283,10 +282,6 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
283282
this._hoverOnColumn = this._editor.getModel().getLineContent(line).indexOf(text) + 1 || -1;
284283
}
285284
}));
286-
this._disposableStore.add(dom.addDisposableListener(child, 'mouseout', () => {
287-
this._hoverOnLine = -1;
288-
this._hoverOnColumn = -1;
289-
}));
290285

291286
return child;
292287
}

0 commit comments

Comments
 (0)