提交 4d02d83c 编写于 作者: B Benjamin Pasero

implicit any (#76442)

上级 919008e9
......@@ -334,7 +334,21 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
}
async log(severity: string, ...messages: string[]): Promise<void> {
console[severity].apply(console, ...messages);
let consoleFn = console.log;
switch (severity) {
case 'error':
consoleFn = console.error;
break;
case 'warn':
consoleFn = console.warn;
break;
case 'info':
consoleFn = console.info;
break;
}
consoleFn(...messages);
}
async showItemInFolder(resource: URI): Promise<void> {
......
......@@ -81,10 +81,10 @@ export class EditorDescriptor implements IEditorDescriptor {
}
}
const INPUT_DESCRIPTORS_PROPERTY = '__$inputDescriptors';
class EditorRegistry implements IEditorRegistry {
private editors: EditorDescriptor[] = [];
private readonly mapEditorToInputs = new Map<EditorDescriptor, SyncDescriptor<EditorInput>[]>();
registerEditor(descriptor: EditorDescriptor, editorInputDescriptor: SyncDescriptor<EditorInput>): void;
registerEditor(descriptor: EditorDescriptor, editorInputDescriptor: SyncDescriptor<EditorInput>[]): void;
......@@ -99,7 +99,8 @@ class EditorRegistry implements IEditorRegistry {
}
// Register (Support multiple Editors per Input)
descriptor[INPUT_DESCRIPTORS_PROPERTY] = inputDescriptors;
this.mapEditorToInputs.set(descriptor, inputDescriptors);
this.editors.push(descriptor);
}
......@@ -108,20 +109,22 @@ class EditorRegistry implements IEditorRegistry {
const matchingDescriptors: EditorDescriptor[] = [];
for (const editor of this.editors) {
const inputDescriptors: SyncDescriptor<EditorInput>[] = editor[INPUT_DESCRIPTORS_PROPERTY];
for (const inputDescriptor of inputDescriptors) {
const inputClass = inputDescriptor.ctor;
// Direct check on constructor type (ignores prototype chain)
if (!byInstanceOf && input.constructor === inputClass) {
matchingDescriptors.push(editor);
break;
}
// Normal instanceof check
else if (byInstanceOf && input instanceof inputClass) {
matchingDescriptors.push(editor);
break;
const inputDescriptors: SyncDescriptor<EditorInput>[] | undefined = this.mapEditorToInputs.get(editor);
if (inputDescriptors) {
for (const inputDescriptor of inputDescriptors) {
const inputClass = inputDescriptor.ctor;
// Direct check on constructor type (ignores prototype chain)
if (!byInstanceOf && input.constructor === inputClass) {
matchingDescriptors.push(editor);
break;
}
// Normal instanceof check
else if (byInstanceOf && input instanceof inputClass) {
matchingDescriptors.push(editor);
break;
}
}
}
}
......@@ -175,8 +178,10 @@ class EditorRegistry implements IEditorRegistry {
getEditorInputs(): SyncDescriptor<EditorInput>[] {
const inputClasses: SyncDescriptor<EditorInput>[] = [];
for (const editor of this.editors) {
const editorInputDescriptors: SyncDescriptor<EditorInput>[] = editor[INPUT_DESCRIPTORS_PROPERTY];
inputClasses.push(...editorInputDescriptors.map(descriptor => descriptor.ctor));
const editorInputDescriptors: SyncDescriptor<EditorInput>[] | undefined = this.mapEditorToInputs.get(editor);
if (editorInputDescriptors) {
inputClasses.push(...editorInputDescriptors.map(descriptor => descriptor.ctor));
}
}
return inputClasses;
......
......@@ -408,7 +408,7 @@ export class ElectronWindow extends Disposable {
const options = {
companyName: product.crashReporter.companyName,
productName: product.crashReporter.productName,
submitURL: isWindows ? product.hockeyApp[`win32-${process.arch}`] : isLinux ? product.hockeyApp[`linux-${process.arch}`] : product.hockeyApp.darwin,
submitURL: isWindows ? product.hockeyApp[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? product.hockeyApp[`linux-x64`] : product.hockeyApp.darwin,
extra: {
vscode_version: pkg.version,
vscode_commit: product.commit
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册