mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-20 20:10:11 -04:00
Merge from vscode de81ccf04849309f843db21130c806a5783678f7 (#4738)
This commit is contained in:
@@ -131,17 +131,19 @@ export class DefinitionAction extends EditorAction {
|
||||
alert(msg);
|
||||
|
||||
const { gotoLocation } = editor.getConfiguration().contribInfo;
|
||||
if (this._configuration.openInPeek || (gotoLocation.many === 'peek' && model.references.length > 1)) {
|
||||
if (this._configuration.openInPeek || (gotoLocation.multiple === 'peek' && model.references.length > 1)) {
|
||||
this._openInPeek(editorService, editor, model);
|
||||
|
||||
} else if (editor.hasModel()) {
|
||||
const next = model.nearestReference(editor.getModel().uri, editor.getPosition());
|
||||
if (next) {
|
||||
const targetEditor = await this._openReference(editor, editorService, next, this._configuration.openToSide);
|
||||
if (targetEditor && model.references.length > 1 && gotoLocation.many === 'revealAndPeek') {
|
||||
this._openInPeek(editorService, targetEditor, model);
|
||||
} else {
|
||||
model.dispose();
|
||||
}
|
||||
const next = model.firstReference();
|
||||
if (!next) {
|
||||
return;
|
||||
}
|
||||
const targetEditor = await this._openReference(editor, editorService, next, this._configuration.openToSide);
|
||||
if (targetEditor && model.references.length > 1 && gotoLocation.multiple === 'gotoAndPeek') {
|
||||
this._openInPeek(editorService, targetEditor, model);
|
||||
} else {
|
||||
model.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ export class OneReference {
|
||||
|
||||
constructor(
|
||||
readonly parent: FileReferences,
|
||||
private _range: IRange
|
||||
private _range: IRange,
|
||||
readonly isProviderFirst: boolean
|
||||
) {
|
||||
this.id = defaultGenerator.nextId();
|
||||
}
|
||||
@@ -173,6 +174,7 @@ export class ReferencesModel implements IDisposable {
|
||||
constructor(references: LocationLink[]) {
|
||||
this._disposables = [];
|
||||
// grouping and sorting
|
||||
const [providersFirst] = references;
|
||||
references.sort(ReferencesModel._compareReferences);
|
||||
|
||||
let current: FileReferences | undefined;
|
||||
@@ -187,7 +189,7 @@ export class ReferencesModel implements IDisposable {
|
||||
if (current.children.length === 0
|
||||
|| !Range.equalsRange(ref.range, current.children[current.children.length - 1].range)) {
|
||||
|
||||
let oneRef = new OneReference(current, ref.targetSelectionRange || ref.range);
|
||||
let oneRef = new OneReference(current, ref.targetSelectionRange || ref.range, providersFirst === ref);
|
||||
this._disposables.push(oneRef.onRefChanged((e) => this._onDidChangeReferenceRange.fire(e)));
|
||||
this.references.push(oneRef);
|
||||
current.children.push(oneRef);
|
||||
@@ -267,6 +269,15 @@ export class ReferencesModel implements IDisposable {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
firstReference(): OneReference | undefined {
|
||||
for (const ref of this.references) {
|
||||
if (ref.isProviderFirst) {
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
return this.references[0];
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
dispose(this.groups);
|
||||
dispose(this._disposables);
|
||||
|
||||
Reference in New Issue
Block a user