mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 18:46:36 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -32,21 +32,21 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
|
||||
private static readonly ID = 'editor.contrib.referencesController';
|
||||
|
||||
private _editor: ICodeEditor;
|
||||
private _widget: ReferenceWidget;
|
||||
private _model: ReferencesModel;
|
||||
private readonly _editor: ICodeEditor;
|
||||
private _widget: ReferenceWidget | null;
|
||||
private _model: ReferencesModel | null;
|
||||
private _requestIdPool = 0;
|
||||
private _disposables: IDisposable[] = [];
|
||||
private _ignoreModelChangeEvent = false;
|
||||
|
||||
private _referenceSearchVisible: IContextKey<boolean>;
|
||||
private readonly _referenceSearchVisible: IContextKey<boolean>;
|
||||
|
||||
public static get(editor: ICodeEditor): ReferencesController {
|
||||
return editor.getContribution<ReferencesController>(ReferencesController.ID);
|
||||
}
|
||||
|
||||
public constructor(
|
||||
private _defaultTreeKeyboardSupport: boolean,
|
||||
private readonly _defaultTreeKeyboardSupport: boolean,
|
||||
editor: ICodeEditor,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@ICodeEditorService private readonly _editorService: ICodeEditorService,
|
||||
@@ -66,23 +66,26 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
public dispose(): void {
|
||||
this._referenceSearchVisible.reset();
|
||||
dispose(this._disposables);
|
||||
dispose(this._widget);
|
||||
dispose(this._model);
|
||||
this._widget = null;
|
||||
this._model = null;
|
||||
this._editor = null;
|
||||
if (this._widget) {
|
||||
dispose(this._widget);
|
||||
this._widget = null;
|
||||
}
|
||||
if (this._model) {
|
||||
dispose(this._model);
|
||||
this._model = null;
|
||||
}
|
||||
}
|
||||
|
||||
public toggleWidget(range: Range, modelPromise: CancelablePromise<ReferencesModel>, options: RequestOptions): void {
|
||||
|
||||
// close current widget and return early is position didn't change
|
||||
let widgetPosition: Position;
|
||||
let widgetPosition: Position | undefined;
|
||||
if (this._widget) {
|
||||
widgetPosition = this._widget.position;
|
||||
}
|
||||
this.closeWidget();
|
||||
if (!!widgetPosition && range.containsPosition(widgetPosition)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
this._referenceSearchVisible.set(true);
|
||||
@@ -101,9 +104,10 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
this._widget.show(range);
|
||||
this._disposables.push(this._widget.onDidClose(() => {
|
||||
modelPromise.cancel();
|
||||
|
||||
this._storageService.store(storageKey, JSON.stringify(this._widget.layoutData), StorageScope.GLOBAL);
|
||||
this._widget = null;
|
||||
if (this._widget) {
|
||||
this._storageService.store(storageKey, JSON.stringify(this._widget.layoutData), StorageScope.GLOBAL);
|
||||
this._widget = null;
|
||||
}
|
||||
this.closeWidget();
|
||||
}));
|
||||
|
||||
@@ -119,13 +123,17 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
break;
|
||||
}
|
||||
case 'side':
|
||||
this.openReference(element, kind === 'side');
|
||||
if (element) {
|
||||
this.openReference(element, kind === 'side');
|
||||
}
|
||||
break;
|
||||
case 'goto':
|
||||
if (options.onGoto) {
|
||||
options.onGoto(element);
|
||||
} else {
|
||||
this._gotoReference(element);
|
||||
if (element) {
|
||||
if (options.onGoto) {
|
||||
options.onGoto(element);
|
||||
} else {
|
||||
this._gotoReference(element);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -148,7 +156,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
|
||||
// show widget
|
||||
return this._widget.setModel(this._model).then(() => {
|
||||
if (this._widget) { // might have been closed
|
||||
if (this._widget && this._model && this._editor.hasModel()) { // might have been closed
|
||||
// set title
|
||||
this._widget.setMetaTitle(options.getMetaTitle(this._model));
|
||||
|
||||
@@ -169,31 +177,46 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
}
|
||||
|
||||
public async goToNextOrPreviousReference(fwd: boolean) {
|
||||
if (this._model) { // can be called while still resolving...
|
||||
let source = this._model.nearestReference(this._editor.getModel().uri, this._widget.position);
|
||||
let target = this._model.nextOrPreviousReference(source, fwd);
|
||||
let editorFocus = this._editor.hasTextFocus();
|
||||
await this._widget.setSelection(target);
|
||||
await this._gotoReference(target);
|
||||
if (editorFocus) {
|
||||
this._editor.focus();
|
||||
}
|
||||
if (!this._editor.hasModel() || !this._model || !this._widget) {
|
||||
// can be called while still resolving...
|
||||
return;
|
||||
}
|
||||
const currentPosition = this._widget.position;
|
||||
if (!currentPosition) {
|
||||
return;
|
||||
}
|
||||
const source = this._model.nearestReference(this._editor.getModel().uri, currentPosition);
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
const target = this._model.nextOrPreviousReference(source, fwd);
|
||||
const editorFocus = this._editor.hasTextFocus();
|
||||
await this._widget.setSelection(target);
|
||||
await this._gotoReference(target);
|
||||
if (editorFocus) {
|
||||
this._editor.focus();
|
||||
}
|
||||
}
|
||||
|
||||
public closeWidget(): void {
|
||||
dispose(this._widget);
|
||||
this._widget = null;
|
||||
if (this._widget) {
|
||||
dispose(this._widget);
|
||||
this._widget = null;
|
||||
}
|
||||
this._referenceSearchVisible.reset();
|
||||
this._disposables = dispose(this._disposables);
|
||||
dispose(this._model);
|
||||
this._model = null;
|
||||
if (this._model) {
|
||||
dispose(this._model);
|
||||
this._model = null;
|
||||
}
|
||||
this._editor.focus();
|
||||
this._requestIdPool += 1; // Cancel pending requests
|
||||
}
|
||||
|
||||
private _gotoReference(ref: Location): Promise<any> {
|
||||
this._widget.hide();
|
||||
if (this._widget) {
|
||||
this._widget.hide();
|
||||
}
|
||||
|
||||
this._ignoreModelChangeEvent = true;
|
||||
const range = Range.lift(ref.range).collapseToStart();
|
||||
@@ -216,8 +239,10 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
|
||||
return;
|
||||
}
|
||||
|
||||
this._widget.show(range);
|
||||
this._widget.focus();
|
||||
if (this._widget) {
|
||||
this._widget.show(range);
|
||||
this._widget.focus();
|
||||
}
|
||||
|
||||
}, (err) => {
|
||||
this._ignoreModelChangeEvent = false;
|
||||
|
||||
Reference in New Issue
Block a user