这个也是main函数开始的,下面就是最后一行代码,表示export出rSo 函数作为它的名字公开为main, 和dll export表有点像了。
export {
rSo as main
};
其中rSO是
function rSo(i) {
return new nSo(i).open()
}
nSO是一个类,应该是就是workbenchMain了。
var nSo = class extends V {
constructor(i) {
super(), this.a = i, this.b()
}
b() {
this.c(), fle(!!this.a.fullscreen, _t)
}
c() {
const i = YCn(this.a.workspace);
(oN(i) || mC(i)) && (this.a.workspace = i);
const e = this.a.filesToWait,
t = e ? .paths;
for (const s of [t, this.a.filesToOpenOrCreate, this.a.filesToDiff, this.a.filesToMerge])
if (Array.isArray(s))
for (const n of s) n.fileUri && (n.fileUri = W.revive(n.fileUri));
e && (e.waitMarkerFileUri = W.revive(e.waitMarkerFileUri))
}
async open() {
const [i] = await Promise.all([this.j(), H0n(_t)]);
this.f(i.configurationService);
const e = new T0o(_t.document.body, {
extraClasses: this.g()
}, i.serviceCollection, i.logService);
this.h(e, i.storageService);
const t = e.startup();
this.D(t.createInstance(dCt))
}
f(i) {
let e;
if (this.a.isCustomZoomLevel && typeof this.a.zoomLevel == "number") e = this.a.zoomLevel;
else {
const t = i.getValue();
e = typeof t.window ? .zoomLevel == "number" ? t.window.zoomLevel : 0
}
rxe(e, _t)
}
g() {
return Bt && LRi(this.a.os.release) ? ["macos-bigsur-or-newer"] : []
}
h(i, e) {
this.D(i.onWillShutdown(t => t.join(e.close(), {
id: "join.closeStorage",
label: f(12421, null)
}))), this.D(i.onDidShutdown(() => this.dispose()))
}
async j() {
const i = new Da,
e = this.D(new VCo(this.a.windowId));
i.set(mI, e);
const t = this.a.policiesData ? new YCo(this.a.policiesData, e.getChannel("policy")) : new Esn;
i.set(ksn, t);
const s = {
_serviceBrand: void 0,
...ao
};
i.set(os, s);
const n = new Gf(this.a, s);
i.set(Vl, n);
const r = [...this.a.loggers.global.map(D => ({ ...D,
resource: W.revive(D.resource)
})), ...this.a.loggers.window.map(D => ({ ...D,
resource: W.revive(D.resource),
hidden: !0
}))],
o = new Pho(this.a.windowId, this.a.logLevel, n.windowLogsPath, r, e.getChannel("logger"));
i.set(Ip, o);
const a = this.D(new jCo(o, n));
i.set(Ft, a), av && a.info("workbench#open()"), a.getLevel() === Un.Trace && a.trace("workbench#open(): with configuration", Nze({ ...this.a,
nls: void 0
}));
const l = new KCi(this.a.windowId, a);
i.set(f5, l);
const c = new FCi(this.a.windowId, a, e);
i.set(gsn, c);
const u = JE.toService(e.getChannel("sign"));
i.set(bCt, u);
const h = this.D(new tSi(a));
i.set(yt, h);
const d = new YCi(s, new rSi(n.window.id, e, h));
i.set(Ym, d);
const g = this.D(new GCo(e, c, a, o));
h.registerProvider(me.file, g);
const p = new yCt(h);
i.set(bs, p);
const m = new c8s(this.a.profiles.all, W.revive(this.a.profiles.home).with({
scheme: n.userRoamingDataHome.scheme
}), e.getChannel("userDataProfiles"));
i.set(_a, m);
const v = new XCo(Fk(this.a.profiles.profile, m.profilesHome.scheme));
i.set(Pl, v), h.registerProvider(me.vscodeUserData, this.D(new KCo(me.file, g, me.vscodeUserData, m, p, a)));
const y = new zIr;
y.register(0, new tSo(null)), i.set(Vye, y);
const w = this.D(new QCi(y, v, n, s, d, u, a));
i.set(Ia, w), this.D(FCo.register(w, h, a));
const C = this.m(n),
[S, x] = await Promise.all([this.n(C, n, v, m, h, w, p, a, t).then(D => (i.set(Dt, D), i.set(rI, D), D)), this.q(C, n, v, m, e).then(D => (i.set(ft, D), D)), this.r(e).then(D => (i.set(_sn, D), D))]),
k = new T9t(S, n);
i.set(z3, k);
const I = new P9t(S, d, x, p, n, S, k, h);
return i.set(Dd, I), S.updateWorkspaceTrust(I.isWorkspaceTrusted()), this.D(I.onDidChangeTrust(() => S.updateWorkspaceTrust(I.isWorkspaceTrusted()))), {
serviceCollection: i,
logService: a,
storageService: x,
configurationService: S
}
}
m(i) {
return this.a.workspace ? this.a.workspace : NS(this.a.backupPath, i.isExtensionDevelopment)
}
async n(i, e, t, s, n, r, o, a, l) {
const c = new OCo([me.file, me.vscodeUserData], e, n),
u = new SCo({
remoteAuthority: e.remoteAuthority,
configurationCache: c
}, e, t, s, n, r, o, a, l);
try {
return await u.initialize(i), u
} catch (h) {
return ls(h), u
}
}
async q(i, e, t, s, n) {
const r = new ECo(i, t, s, n, e);
try {
return await r.initialize(), r
} catch (o) {
return ls(o), r
}
}
async r(i) {
const e = new nSi(i);
try {
return await e.initialize(), e
} catch (t) {
return ls(t), e
}
}
};