mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 17:52:34 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -36,12 +36,12 @@ export interface IEditorRegistry {
|
||||
/**
|
||||
* Returns the editor descriptor for the given input or null if none.
|
||||
*/
|
||||
getEditor(input: EditorInput): IEditorDescriptor;
|
||||
getEditor(input: EditorInput): IEditorDescriptor | null;
|
||||
|
||||
/**
|
||||
* Returns the editor descriptor for the given identifier or null if none.
|
||||
*/
|
||||
getEditorById(editorId: string): IEditorDescriptor;
|
||||
getEditorById(editorId: string): IEditorDescriptor | null;
|
||||
|
||||
/**
|
||||
* Returns an array of registered editors known to the platform.
|
||||
@@ -103,15 +103,14 @@ class EditorRegistry implements IEditorRegistry {
|
||||
this.editors.push(descriptor);
|
||||
}
|
||||
|
||||
getEditor(input: EditorInput): EditorDescriptor {
|
||||
getEditor(input: EditorInput): EditorDescriptor | null {
|
||||
const findEditorDescriptors = (input: EditorInput, byInstanceOf?: boolean): EditorDescriptor[] => {
|
||||
const matchingDescriptors: EditorDescriptor[] = [];
|
||||
|
||||
for (let i = 0; i < this.editors.length; i++) {
|
||||
const editor = this.editors[i];
|
||||
for (const editor of this.editors) {
|
||||
const inputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
|
||||
for (let j = 0; j < inputDescriptors.length; j++) {
|
||||
const inputClass = inputDescriptors[j].ctor;
|
||||
for (const inputDescriptor of inputDescriptors) {
|
||||
const inputClass = inputDescriptor.ctor;
|
||||
|
||||
// Direct check on constructor type (ignores prototype chain)
|
||||
if (!byInstanceOf && input.constructor === inputClass) {
|
||||
@@ -155,9 +154,8 @@ class EditorRegistry implements IEditorRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
getEditorById(editorId: string): EditorDescriptor {
|
||||
for (let i = 0; i < this.editors.length; i++) {
|
||||
const editor = this.editors[i];
|
||||
getEditorById(editorId: string): EditorDescriptor | null {
|
||||
for (const editor of this.editors) {
|
||||
if (editor.getId() === editorId) {
|
||||
return editor;
|
||||
}
|
||||
@@ -176,8 +174,7 @@ class EditorRegistry implements IEditorRegistry {
|
||||
|
||||
getEditorInputs(): any[] {
|
||||
const inputClasses: any[] = [];
|
||||
for (let i = 0; i < this.editors.length; i++) {
|
||||
const editor = this.editors[i];
|
||||
for (const editor of this.editors) {
|
||||
const editorInputDescriptors = <SyncDescriptor<EditorInput>[]>editor[INPUT_DESCRIPTORS_PROPERTY];
|
||||
inputClasses.push(...editorInputDescriptors.map(descriptor => descriptor.ctor));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user