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
		}
	}
};
相关推荐
ღ_23331 小时前
vue3二次封装element-plus表格,slot透传,动态slot。
前端·javascript·vue.js
xiaohe06011 小时前
🔒 JavaScript 不是单线程吗?怎么还能上“锁”?!
javascript·github
摸着石头过河的石头1 小时前
JavaScript继承的多种实现方式详解
前端·javascript
Ashley的成长之路1 小时前
NativeScript-Vue 开发指南:直接使用 Vue构建原生移动应用
前端·javascript·vue.js
软件技术NINI2 小时前
MATLAB疑难诊疗:从调试到优化的全攻略
javascript·css·python·html
知识分享小能手3 小时前
uni-app 入门学习教程,从入门到精通,uni-app组件 —— 知识点详解与实战案例(4)
前端·javascript·学习·微信小程序·小程序·前端框架·uni-app
苏打水com3 小时前
从 HTML/CSS/JS 到 React:前端进阶的平滑过渡指南
前端·javascript·html
一枚前端小能手3 小时前
🔐 单点登录还在手动跳转?这几个SSO实现技巧让你的用户体验飞起来
前端·javascript
tianchang3 小时前
深入理解 JavaScript 异步机制:从语言语义到事件循环的全景图
前端·javascript
JNU freshman4 小时前
vue 技巧与易错
前端·javascript·vue.js