Skip to content

Commit 1a0cce8

Browse files
committed
1 parent 5f3a2e8 commit 1a0cce8

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/vs/editor/contrib/referenceSearch/referencesController.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
1919
import * as editorCommon from 'vs/editor/common/editorCommon';
2020
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
2121
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
22-
import { ReferencesModel, OneReference } from './referencesModel';
22+
import { ReferencesModel } from './referencesModel';
2323
import { ReferenceWidget, LayoutData } from './referencesWidget';
2424
import { Range } from 'vs/editor/common/core/range';
2525
import { ITextModelService } from 'vs/editor/common/services/resolverService';
2626
import { IThemeService } from 'vs/platform/theme/common/themeService';
2727
import { Position } from 'vs/editor/common/core/position';
2828
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
29+
import { Location } from 'vs/editor/common/modes';
2930

3031
export const ctxReferenceSearchVisible = new RawContextKey<boolean>('referenceSearchVisible', false);
3132

3233
export interface RequestOptions {
3334
getMetaTitle(model: ReferencesModel): string;
34-
onGoto?: (reference: OneReference) => TPromise<any>;
35+
onGoto?: (reference: Location) => TPromise<any>;
3536
}
3637

3738
export class ReferencesController implements editorCommon.IEditorContribution {
@@ -189,7 +190,7 @@ export class ReferencesController implements editorCommon.IEditorContribution {
189190
this._requestIdPool += 1; // Cancel pending requests
190191
}
191192

192-
private _gotoReference(ref: OneReference): void {
193+
private _gotoReference(ref: Location): void {
193194
this._widget.hide();
194195

195196
this._ignoreModelChangeEvent = true;
@@ -222,7 +223,7 @@ export class ReferencesController implements editorCommon.IEditorContribution {
222223
});
223224
}
224225

225-
private _openReference(ref: OneReference, sideBySide: boolean): void {
226+
private _openReference(ref: Location, sideBySide: boolean): void {
226227
const { uri, range } = ref;
227228
this._editorService.openEditor({
228229
resource: uri,

src/vs/editor/contrib/referenceSearch/referencesWidget.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
4242
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
4343
import URI from 'vs/base/common/uri';
4444
import { TrackedRangeStickiness, IModelDeltaDecoration } from 'vs/editor/common/model';
45+
import { Location } from 'vs/editor/common/modes';
4546

4647
class DecorationsManager implements IDisposable {
4748

@@ -558,7 +559,7 @@ export interface LayoutData {
558559
export interface SelectionEvent {
559560
kind: 'goto' | 'show' | 'side' | 'open';
560561
source: 'editor' | 'tree' | 'title';
561-
element: OneReference;
562+
element: Location;
562563
}
563564

564565
/**
@@ -783,11 +784,12 @@ export class ReferenceWidget extends PeekViewWidget {
783784
this._disposeOnNewModel.push(this._model.onDidChangeReferenceRange(reference => this._tree.refresh(reference)));
784785

785786
// listen on editor
786-
this._disposeOnNewModel.push(this._preview.onMouseDown((e) => {
787-
if (e.event.detail === 2) {
787+
this._disposeOnNewModel.push(this._preview.onMouseDown(e => {
788+
const { event, target } = e;
789+
if (event.detail === 2) {
788790
this._onDidSelectReference.fire({
789-
element: this._getFocusedReference(),
790-
kind: (e.event.ctrlKey || e.event.metaKey) ? 'side' : 'open',
791+
element: { uri: this._getFocusedReference().uri, range: target.range },
792+
kind: (event.ctrlKey || event.metaKey) ? 'side' : 'open',
791793
source: 'editor'
792794
});
793795
}

0 commit comments

Comments
 (0)