未验证 提交 8a4873db 编写于 作者: J Johannes Rieken 提交者: GitHub

Merge pull request #90109 from GustavoASC/master

Fixed bug where one could open 'peek' inside 'peek' on definition link
......@@ -28,6 +28,9 @@ import { Position } from 'vs/editor/common/core/position';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { PeekContext } from 'vs/editor/contrib/peekView/peekView';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
export class GotoDefinitionAtPositionEditorContribution implements IEditorContribution {
......@@ -335,9 +338,17 @@ export class GotoDefinitionAtPositionEditorContribution implements IEditorContri
private gotoDefinition(position: Position, openToSide: boolean): Promise<any> {
this.editor.setPosition(position);
const openInPeek = this.editor.getOption(EditorOption.definitionLinkOpensInPeek);
const action = new DefinitionAction({ openToSide, openInPeek: openInPeek, muteMessage: true }, { alias: '', label: '', id: '', precondition: undefined });
return this.editor.invokeWithinContext(accessor => action.run(accessor, this.editor));
const definitionLinkOpensInPeek = this.editor.getOption(EditorOption.definitionLinkOpensInPeek);
return this.editor.invokeWithinContext((accessor) => {
const canPeek = definitionLinkOpensInPeek && !this.isInPeekEditor(accessor);
const action = new DefinitionAction({ openToSide, openInPeek: canPeek, muteMessage: true }, { alias: '', label: '', id: '', precondition: undefined });
return action.run(accessor, this.editor);
});
}
private isInPeekEditor(accessor: ServicesAccessor): boolean | undefined {
const contextKeyService = accessor.get(IContextKeyService);
return PeekContext.inPeekEditor.getValue(contextKeyService);
}
public dispose(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册