VsCode/Cursor workbench.desktop.main.js 的入口

这个也是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
		}
	}
};
相关推荐
程序员大澈6 分钟前
1个基于 Three.js 的 Vue3 组件库
javascript·vue.js
程序员大澈12 分钟前
3个 Vue Scoped 的核心原理
javascript·vue.js
hyyyyy!15 分钟前
《原型链的故事:JavaScript 对象模型的秘密》
javascript·原型模式
程序员大澈25 分钟前
3个好玩且免费的api接口
javascript·vue.js
程序员大澈1 小时前
4个 Vue 路由实现的过程
javascript·vue.js·uni-app
几度泥的菜花1 小时前
如何禁用移动端页面的多点触控和手势缩放
前端·javascript
狼性书生1 小时前
electron + vue3 + vite 渲染进程到主进程的双向通信
前端·javascript·electron
拉不动的猪1 小时前
Node.js(Express)
前端·javascript·面试
Re.不晚2 小时前
Web前端开发——HTML基础下
前端·javascript·html
vjmap2 小时前
如何免费使用AI编程工具(如Trae或Cursor)生成CAD图纸?
javascript