提交 725414d3 编写于 作者: J Johannes Rieken

fix #23978

上级 a58e086d
......@@ -29,9 +29,10 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
export class DefinitionActionConfig {
constructor(
public openToSide = false,
public openInPeek = false,
public filterCurrent = true
public readonly openToSide = false,
public readonly openInPeek = false,
public readonly filterCurrent = true,
public readonly showMessage = true,
) {
//
}
......@@ -85,9 +86,10 @@ export class DefinitionAction extends EditorAction {
if (result.length === 0) {
// no result -> show message
const info = model.getWordAtPosition(pos);
MessageController.get(editor).showMessage(this._getNoResultFoundMessage(info), pos);
if (this._configuration.showMessage) {
const info = model.getWordAtPosition(pos);
MessageController.get(editor).showMessage(this._getNoResultFoundMessage(info), pos);
}
} else if (result.length === 1 && idxOfCurrent !== -1) {
// only the position at which we are -> adjust selection
let [current] = result;
......
......@@ -28,7 +28,7 @@ import { ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursor
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { editorActiveLinkForeground } from 'vs/platform/theme/common/colorRegistry';
import { EditorState, CodeEditorStateFlag } from 'vs/editor/common/core/editorState';
import { OpenDefinitionToSideAction, GoToDefinitionAction } from './goToDeclarationCommands';
import { DefinitionAction, DefinitionActionConfig } from './goToDeclarationCommands';
@editorContribution
class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorContribution {
......@@ -259,14 +259,9 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
}
private gotoDefinition(target: IMouseTarget, sideBySide: boolean): TPromise<any> {
const targetAction = sideBySide
? OpenDefinitionToSideAction.ID
: GoToDefinitionAction.ID;
// just run the corresponding action
this.editor.setPosition(target.position);
return this.editor.getAction(targetAction).run();
const action = new DefinitionAction(new DefinitionActionConfig(sideBySide, false, true, false), { alias: undefined, label: undefined, id: undefined, precondition: undefined });
return this.editor.invokeWithinContext(accessor => action.run(accessor, this.editor));
}
public getId(): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册