Skip to content

Commit d8519d2

Browse files
authored
chore: bump vscode to 1.101.2 (conwnet#634)
1 parent aa2a2fc commit d8519d2

File tree

10 files changed

+72
-41
lines changed

10 files changed

+72
-41
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"license": "ISC",
3131
"devDependencies": {
3232
"@cloudflare/workers-types": "^4.20250109.0",
33-
"@github1s/vscode-web": "0.25.1",
33+
"@github1s/vscode-web": "^0.26.0",
3434
"chokidar": "^4.0.3",
3535
"clean-css": "^5.3.3",
3636
"copy-webpack-plugin": "^12.0.2",

vscode-web/.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.99.1
1+
1.101.2

vscode-web/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@github1s/vscode-web",
3-
"version": "0.25.1",
3+
"version": "0.26.0",
44
"description": "VS Code web for GitHub1s",
55
"author": "github1s",
66
"license": "MIT",

vscode-web/scripts/.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"src/vs/workbench/browser/parts/activitybar/activitybarPart.ts": "a195c8b4170a58eca301c3044ae278fa3b811539a7274830691afc73f6da86b8",
2+
"src/vs/workbench/browser/parts/activitybar/activitybarPart.ts": "49575327f7d302dad48a46beba42a675c75d6bfd2caa6b3e5e3bb3e7f41a71e0",
33
"src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css": "6be71e59eeb2e650262bb6d15a05dbd7636928fbbae7f33998f1554b436b4108",
4-
"src/vs/workbench/browser/web.main.ts": "0cf354b9221fdb15a738366043fbf69d8f8373891faf9f5e66a033de935eba79",
4+
"src/vs/workbench/browser/web.main.ts": "b3276e26f954a434d1b6174eeece432f448fbbd831566d6451aa35208a0d5627",
55
"src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts": "e986095a30dbea54af56c25fa1b184b55f34f8914129b27e2f20d8c4ea9fd16b",
6-
"src/vs/workbench/contrib/webview/browser/pre/index.html": "a325d58526d8ac86f3460afdb63787e09ea71d10e95c20518b92586ed028834c",
6+
"src/vs/workbench/contrib/webview/browser/pre/index.html": "7ce2885c633813288123a7dde3981448e387471450cf0d861c1c02b9cbdbf0bc",
77
"src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts": "c220568141adf6ed560bab754ea7769795465c6fa93ecd461e9b59f05ca56377",
88
"src/vs/workbench/services/label/common/labelService.ts": "72d72581bd521c2edadd60d4458de4d1c6a9a2cc2cf83820034c82815a2eae6a",
9-
"src/vs/workbench/services/textfile/browser/textFileService.ts": "fbb6ae9a1d9ed4d57ce8b0f91e54c5a9505a293a8b15c72e09773ee54fb5cd28",
9+
"src/vs/workbench/services/textfile/browser/textFileService.ts": "607da093a8562c6a42e9bdb1b2456fa9eb1065a53a5ac6afbb323f6f8505e03f",
1010
"src/vs/base/common/network.ts": "34fc2461d4b6029e71b60a3bf5d7438585e9d2b66ccdcab0893cc69d77fab5b5",
1111
"src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html": "40d576ad2307d28012b34b86858ba36ba49ae10e5aedb394bd06b14a35b869a5"
1212
}

vscode-web/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { addDisposableListener, append, EventType, isAncestor, $, clearNode } fr
1919
import { assertIsDefined } from '../../../../base/common/types.js';
2020
import { CustomMenubarControl } from '../titlebar/menubarControl.js';
2121
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
22-
import { getMenuBarVisibility } from '../../../../platform/window/common/window.js';
22+
import { getMenuBarVisibility, MenuSettings } from '../../../../platform/window/common/window.js';
2323
import { IAction, Separator, SubmenuAction, toAction } from '../../../../base/common/actions.js';
2424
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
2525
import { KeyCode } from '../../../../base/common/keyCodes.js';
@@ -194,7 +194,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
194194

195195
private element: HTMLElement | undefined;
196196

197-
private menuBar: CustomMenubarControl | undefined;
197+
private readonly menuBar = this._register(new MutableDisposable<CustomMenubarControl>());
198198
private menuBarContainer: HTMLElement | undefined;
199199
private compositeBarContainer: HTMLElement | undefined;
200200
private readonly globalCompositeBar: GlobalCompositeBar | undefined;
@@ -231,7 +231,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
231231

232232
// Register for configuration changes
233233
this._register(this.configurationService.onDidChangeConfiguration(e => {
234-
if (e.affectsConfiguration('window.menuBarVisibility')) {
234+
if (e.affectsConfiguration(MenuSettings.MenuBarVisibility)) {
235235
if (getMenuBarVisibility(this.configurationService) === 'compact') {
236236
this.installMenubar();
237237
} else {
@@ -245,12 +245,12 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
245245
// Menu
246246
const menuBarVisibility = getMenuBarVisibility(this.configurationService);
247247
if (menuBarVisibility === 'compact' || menuBarVisibility === 'hidden' || menuBarVisibility === 'toggle') {
248-
actions.unshift(...[toAction({ id: 'toggleMenuVisibility', label: localize('menu', "Menu"), checked: menuBarVisibility === 'compact', run: () => this.configurationService.updateValue('window.menuBarVisibility', menuBarVisibility === 'compact' ? 'toggle' : 'compact') }), new Separator()]);
248+
actions.unshift(...[toAction({ id: 'toggleMenuVisibility', label: localize('menu', "Menu"), checked: menuBarVisibility === 'compact', run: () => this.configurationService.updateValue(MenuSettings.MenuBarVisibility, menuBarVisibility === 'compact' ? 'toggle' : 'compact') }), new Separator()]);
249249
}
250250

251251
if (menuBarVisibility === 'compact' && this.menuBarContainer && e?.target) {
252252
if (isAncestor(e.target as Node, this.menuBarContainer)) {
253-
actions.unshift(...[toAction({ id: 'hideCompactMenu', label: localize('hideMenu', "Hide Menu"), run: () => this.configurationService.updateValue('window.menuBarVisibility', 'toggle') }), new Separator()]);
253+
actions.unshift(...[toAction({ id: 'hideCompactMenu', label: localize('hideMenu', "Hide Menu"), run: () => this.configurationService.updateValue(MenuSettings.MenuBarVisibility, 'toggle') }), new Separator()]);
254254
}
255255
}
256256

@@ -264,9 +264,8 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
264264
}
265265

266266
private uninstallMenubar() {
267-
if (this.menuBar) {
268-
this.menuBar.dispose();
269-
this.menuBar = undefined;
267+
if (this.menuBar.value) {
268+
this.menuBar.value = undefined;
270269
}
271270

272271
if (this.menuBarContainer) {
@@ -276,7 +275,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
276275
}
277276

278277
private installMenubar() {
279-
if (this.menuBar) {
278+
if (this.menuBar.value) {
280279
return; // prevent menu bar from installing twice #110720
281280
}
282281

@@ -293,8 +292,8 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
293292
/* above codes are changed by github1s */
294293

295294
// Menubar: install a custom menu bar depending on configuration
296-
this.menuBar = this._register(this.instantiationService.createInstance(CustomMenubarControl));
297-
this.menuBar.create(this.menuBarContainer);
295+
this.menuBar.value = this._register(this.instantiationService.createInstance(CustomMenubarControl));
296+
this.menuBar.value.create(this.menuBarContainer);
298297

299298
}
300299

@@ -318,7 +317,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
318317
if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) {
319318
this.globalCompositeBar?.focus();
320319
} else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) {
321-
this.menuBar?.toggleFocus();
320+
this.menuBar.value?.toggleFocus();
322321
}
323322
}));
324323
}

vscode-web/src/vs/workbench/browser/web.main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { IAnyWorkspaceIdentifier, IWorkspaceContextService, UNKNOWN_EMPTY_WINDOW
2727
import { IWorkbenchConfigurationService } from '../services/configuration/common/configuration.js';
2828
import { onUnexpectedError } from '../../base/common/errors.js';
2929
import { setFullscreen } from '../../base/browser/browser.js';
30-
import { URI } from '../../base/common/uri.js';
30+
import { URI, UriComponents } from '../../base/common/uri.js';
3131
import { WorkspaceService } from '../services/configuration/browser/configurationService.js';
3232
import { ConfigurationCache } from '../services/configuration/common/configurationCache.js';
3333
import { ISignService } from '../../platform/sign/common/sign.js';
@@ -182,8 +182,8 @@ export class BrowserMain extends Disposable {
182182

183183
return timerService.getPerformanceMarks();
184184
},
185-
async openUri(uri: URI): Promise<boolean> {
186-
return openerService.open(uri, {});
185+
async openUri(uri: URI | UriComponents): Promise<boolean> {
186+
return openerService.open(URI.isUri(uri) ? uri : URI.from(uri), {});
187187
}
188188
},
189189
logger: {

vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
const onElectron = searchParams.get('platform') === 'electron';
3838
const disableServiceWorker = searchParams.has('disableServiceWorker');
3939
const expectedWorkerVersion = parseInt(searchParams.get('swVersion'));
40+
/** @type {MessageChannel | undefined} */
41+
let outerIframeMessageChannel;
4042

4143
/**
4244
* Use polling to track focus of main webview and iframes within the webview
@@ -237,8 +239,8 @@
237239
return reject(new Error('Service Workers are not enabled. Webviews will not work. Try disabling private/incognito mode.'));
238240
}
239241

240-
const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&id=${ID}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`);
241-
navigator.serviceWorker.register(swPath)
242+
const swPath = encodeURI(`service-worker.js?v=${expectedWorkerVersion}&vscode-resource-base-authority=${searchParams.get('vscode-resource-base-authority')}&remoteAuthority=${searchParams.get('remoteAuthority') ?? ''}`);
243+
navigator.serviceWorker.register(swPath, { type: 'module' })
242244
.then(async registration => {
243245
/**
244246
* @param {MessageEvent} event
@@ -266,7 +268,8 @@
266268
navigator.serviceWorker.addEventListener('message', versionHandler);
267269

268270
const postVersionMessage = (/** @type {ServiceWorker} */ controller) => {
269-
controller.postMessage({ channel: 'version' });
271+
outerIframeMessageChannel = new MessageChannel();
272+
controller.postMessage({ channel: 'version' }, [outerIframeMessageChannel.port2]);
270273
};
271274

272275
// At this point, either the service worker is ready and
@@ -1173,6 +1176,17 @@
11731176

11741177
unloadMonitor.onIframeLoaded(newFrame);
11751178
}
1179+
1180+
if (!disableServiceWorker && outerIframeMessageChannel) {
1181+
outerIframeMessageChannel.port1.onmessage = event => {
1182+
switch (event.data.channel) {
1183+
case 'load-resource':
1184+
case 'load-localhost':
1185+
hostMessaging.postMessage(event.data.channel, event.data);
1186+
return;
1187+
}
1188+
};
1189+
}
11761190
});
11771191

11781192
// propagate vscode-context-menu-visible class

vscode-web/src/vs/workbench/services/textfile/browser/textFileService.ts

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,6 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
277277
return this.fileService.writeFile(resource, readable, options);
278278
}
279279

280-
getEncoding(resource: URI): string {
281-
const model = resource.scheme === Schemas.untitled ? this.untitled.get(resource) : this.files.get(resource);
282-
return model?.getEncoding() ?? this.encoding.getUnvalidatedEncodingForResource(resource);
283-
}
284-
285280
async getEncodedReadable(resource: URI | undefined, value: ITextSnapshot): Promise<VSBufferReadable>;
286281
async getEncodedReadable(resource: URI | undefined, value: string): Promise<VSBuffer | VSBufferReadable>;
287282
async getEncodedReadable(resource: URI | undefined, value?: ITextSnapshot): Promise<VSBufferReadable | undefined>;
@@ -321,14 +316,37 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
321316
candidateGuessEncodings:
322317
options?.candidateGuessEncodings ||
323318
this.textResourceConfigurationService.getValue(resource, 'files.candidateGuessEncodings'),
324-
overwriteEncoding: async detectedEncoding => {
325-
const { encoding } = await this.encoding.getPreferredReadEncoding(resource, options, detectedEncoding ?? undefined);
326-
327-
return encoding;
328-
}
319+
overwriteEncoding: async detectedEncoding => this.validateDetectedEncoding(resource, detectedEncoding ?? undefined, options)
329320
});
330321
}
331322

323+
getEncoding(resource: URI): string {
324+
const model = resource.scheme === Schemas.untitled ? this.untitled.get(resource) : this.files.get(resource);
325+
return model?.getEncoding() ?? this.encoding.getUnvalidatedEncodingForResource(resource);
326+
}
327+
328+
async resolveDecoding(resource: URI | undefined, options?: IReadTextFileEncodingOptions): Promise<{ preferredEncoding: string; guessEncoding: boolean; candidateGuessEncodings: string[] }> {
329+
return {
330+
preferredEncoding: (await this.encoding.getPreferredReadEncoding(resource, options, undefined)).encoding,
331+
guessEncoding:
332+
options?.autoGuessEncoding ||
333+
this.textResourceConfigurationService.getValue(resource, 'files.autoGuessEncoding'),
334+
candidateGuessEncodings:
335+
options?.candidateGuessEncodings ||
336+
this.textResourceConfigurationService.getValue(resource, 'files.candidateGuessEncodings'),
337+
};
338+
}
339+
340+
async validateDetectedEncoding(resource: URI | undefined, detectedEncoding: string | undefined, options?: IReadTextFileEncodingOptions): Promise<string> {
341+
const { encoding } = await this.encoding.getPreferredReadEncoding(resource, options, detectedEncoding);
342+
343+
return encoding;
344+
}
345+
346+
resolveEncoding(resource: URI | undefined, options?: IWriteTextFileOptions): Promise<{ encoding: string; addBOM: boolean }> {
347+
return this.encoding.getWriteEncoding(resource, options);
348+
}
349+
332350
//#endregion
333351

334352

0 commit comments

Comments
 (0)