Skip to content

Commit ee0b779

Browse files
authored
1 parent a2ecf38 commit ee0b779

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ export class ClickLinkMouseEvent {
2525
public readonly hasTriggerModifier: boolean;
2626
public readonly hasSideBySideModifier: boolean;
2727
public readonly isNoneOrSingleMouseDown: boolean;
28-
public readonly hasRightClick: boolean;
28+
public readonly isLeftClick: boolean;
29+
public readonly isMiddleClick: boolean;
30+
public readonly isRightClick: boolean;
2931

3032
constructor(source: IEditorMouseEvent, opts: ClickLinkOptions) {
3133
this.target = source.target;
32-
this.hasRightClick = source.event.rightButton;
34+
this.isLeftClick = source.event.leftButton;
35+
this.isMiddleClick = source.event.middleButton;
36+
this.isRightClick = source.event.rightButton;
3337
this.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);
3438
this.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);
3539
this.isNoneOrSingleMouseDown = (source.event.detail <= 1);

src/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
277277
}
278278

279279
private isEnabled(mouseEvent: ClickLinkMouseEvent, withKey?: ClickLinkKeyboardEvent): boolean {
280-
return this.editor.hasModel() &&
281-
mouseEvent.isNoneOrSingleMouseDown &&
282-
(mouseEvent.target.type === MouseTargetType.CONTENT_TEXT) &&
283-
(mouseEvent.hasTriggerModifier || (withKey ? withKey.keyCodeIsTriggerKey : false)) &&
284-
this.languageFeaturesService.definitionProvider.has(this.editor.getModel());
280+
return this.editor.hasModel()
281+
&& mouseEvent.isLeftClick
282+
&& mouseEvent.isNoneOrSingleMouseDown
283+
&& mouseEvent.target.type === MouseTargetType.CONTENT_TEXT
284+
&& (mouseEvent.hasTriggerModifier || (withKey ? withKey.keyCodeIsTriggerKey : false))
285+
&& this.languageFeaturesService.definitionProvider.has(this.editor.getModel());
285286
}
286287

287288
private findDefinition(position: Position, token: CancellationToken): Promise<LocationLink[] | null> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
152152
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
153153
}
154154
this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor } as Location);
155-
} else if (!e.hasRightClick) {
155+
} else if (!e.isRightClick) {
156156
// Normal click
157157
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
158158
}

0 commit comments

Comments
 (0)