mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-25 15:35:43 +01:00
This commit is contained in:
@@ -25,11 +25,15 @@ export class ClickLinkMouseEvent {
|
||||
public readonly hasTriggerModifier: boolean;
|
||||
public readonly hasSideBySideModifier: boolean;
|
||||
public readonly isNoneOrSingleMouseDown: boolean;
|
||||
public readonly hasRightClick: boolean;
|
||||
public readonly isLeftClick: boolean;
|
||||
public readonly isMiddleClick: boolean;
|
||||
public readonly isRightClick: boolean;
|
||||
|
||||
constructor(source: IEditorMouseEvent, opts: ClickLinkOptions) {
|
||||
this.target = source.target;
|
||||
this.hasRightClick = source.event.rightButton;
|
||||
this.isLeftClick = source.event.leftButton;
|
||||
this.isMiddleClick = source.event.middleButton;
|
||||
this.isRightClick = source.event.rightButton;
|
||||
this.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);
|
||||
this.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);
|
||||
this.isNoneOrSingleMouseDown = (source.event.detail <= 1);
|
||||
|
||||
@@ -277,11 +277,12 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
|
||||
}
|
||||
|
||||
private isEnabled(mouseEvent: ClickLinkMouseEvent, withKey?: ClickLinkKeyboardEvent): boolean {
|
||||
return this.editor.hasModel() &&
|
||||
mouseEvent.isNoneOrSingleMouseDown &&
|
||||
(mouseEvent.target.type === MouseTargetType.CONTENT_TEXT) &&
|
||||
(mouseEvent.hasTriggerModifier || (withKey ? withKey.keyCodeIsTriggerKey : false)) &&
|
||||
this.languageFeaturesService.definitionProvider.has(this.editor.getModel());
|
||||
return this.editor.hasModel()
|
||||
&& mouseEvent.isLeftClick
|
||||
&& mouseEvent.isNoneOrSingleMouseDown
|
||||
&& mouseEvent.target.type === MouseTargetType.CONTENT_TEXT
|
||||
&& (mouseEvent.hasTriggerModifier || (withKey ? withKey.keyCodeIsTriggerKey : false))
|
||||
&& this.languageFeaturesService.definitionProvider.has(this.editor.getModel());
|
||||
}
|
||||
|
||||
private findDefinition(position: Position, token: CancellationToken): Promise<LocationLink[] | null> {
|
||||
|
||||
@@ -152,7 +152,7 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
|
||||
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
|
||||
}
|
||||
this._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel()!.uri, range: this._stickyRangeProjectedOnEditor } as Location);
|
||||
} else if (!e.hasRightClick) {
|
||||
} else if (!e.isRightClick) {
|
||||
// Normal click
|
||||
this._editor.revealPosition({ lineNumber: this._hoverOnLine, column: 1 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user