Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"license": "ISC",
"devDependencies": {
"@cloudflare/workers-types": "^4.20250109.0",
"@github1s/vscode-web": "0.25.1",
"@github1s/vscode-web": "^0.26.0",
"chokidar": "^4.0.3",
"clean-css": "^5.3.3",
"copy-webpack-plugin": "^12.0.2",
Expand Down
2 changes: 1 addition & 1 deletion vscode-web/.VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.99.1
1.101.2
4 changes: 2 additions & 2 deletions vscode-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@github1s/vscode-web",
"version": "0.25.1",
"version": "0.26.0",
"description": "VS Code web for GitHub1s",
"author": "github1s",
"license": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions vscode-web/scripts/.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"src/vs/workbench/browser/parts/activitybar/activitybarPart.ts": "a195c8b4170a58eca301c3044ae278fa3b811539a7274830691afc73f6da86b8",
"src/vs/workbench/browser/parts/activitybar/activitybarPart.ts": "49575327f7d302dad48a46beba42a675c75d6bfd2caa6b3e5e3bb3e7f41a71e0",
"src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css": "6be71e59eeb2e650262bb6d15a05dbd7636928fbbae7f33998f1554b436b4108",
"src/vs/workbench/browser/web.main.ts": "0cf354b9221fdb15a738366043fbf69d8f8373891faf9f5e66a033de935eba79",
"src/vs/workbench/browser/web.main.ts": "b3276e26f954a434d1b6174eeece432f448fbbd831566d6451aa35208a0d5627",
"src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts": "e986095a30dbea54af56c25fa1b184b55f34f8914129b27e2f20d8c4ea9fd16b",
"src/vs/workbench/contrib/webview/browser/pre/index.html": "a325d58526d8ac86f3460afdb63787e09ea71d10e95c20518b92586ed028834c",
"src/vs/workbench/contrib/webview/browser/pre/index.html": "7ce2885c633813288123a7dde3981448e387471450cf0d861c1c02b9cbdbf0bc",
"src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts": "c220568141adf6ed560bab754ea7769795465c6fa93ecd461e9b59f05ca56377",
"src/vs/workbench/services/label/common/labelService.ts": "72d72581bd521c2edadd60d4458de4d1c6a9a2cc2cf83820034c82815a2eae6a",
"src/vs/workbench/services/textfile/browser/textFileService.ts": "fbb6ae9a1d9ed4d57ce8b0f91e54c5a9505a293a8b15c72e09773ee54fb5cd28",
"src/vs/workbench/services/textfile/browser/textFileService.ts": "607da093a8562c6a42e9bdb1b2456fa9eb1065a53a5ac6afbb323f6f8505e03f",
"src/vs/base/common/network.ts": "34fc2461d4b6029e71b60a3bf5d7438585e9d2b66ccdcab0893cc69d77fab5b5",
"src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html": "40d576ad2307d28012b34b86858ba36ba49ae10e5aedb394bd06b14a35b869a5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { addDisposableListener, append, EventType, isAncestor, $, clearNode } fr
import { assertIsDefined } from '../../../../base/common/types.js';
import { CustomMenubarControl } from '../titlebar/menubarControl.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { getMenuBarVisibility } from '../../../../platform/window/common/window.js';
import { getMenuBarVisibility, MenuSettings } from '../../../../platform/window/common/window.js';
import { IAction, Separator, SubmenuAction, toAction } from '../../../../base/common/actions.js';
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
import { KeyCode } from '../../../../base/common/keyCodes.js';
Expand Down Expand Up @@ -194,7 +194,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {

private element: HTMLElement | undefined;

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

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

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

Expand All @@ -264,9 +264,8 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
}

private uninstallMenubar() {
if (this.menuBar) {
this.menuBar.dispose();
this.menuBar = undefined;
if (this.menuBar.value) {
this.menuBar.value = undefined;
}

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

private installMenubar() {
if (this.menuBar) {
if (this.menuBar.value) {
return; // prevent menu bar from installing twice #110720
}

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

// Menubar: install a custom menu bar depending on configuration
this.menuBar = this._register(this.instantiationService.createInstance(CustomMenubarControl));
this.menuBar.create(this.menuBarContainer);
this.menuBar.value = this._register(this.instantiationService.createInstance(CustomMenubarControl));
this.menuBar.value.create(this.menuBarContainer);

}

Expand All @@ -318,7 +317,7 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) {
this.globalCompositeBar?.focus();
} else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) {
this.menuBar?.toggleFocus();
this.menuBar.value?.toggleFocus();
}
}));
}
Expand Down
6 changes: 3 additions & 3 deletions vscode-web/src/vs/workbench/browser/web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { IAnyWorkspaceIdentifier, IWorkspaceContextService, UNKNOWN_EMPTY_WINDOW
import { IWorkbenchConfigurationService } from '../services/configuration/common/configuration.js';
import { onUnexpectedError } from '../../base/common/errors.js';
import { setFullscreen } from '../../base/browser/browser.js';
import { URI } from '../../base/common/uri.js';
import { URI, UriComponents } from '../../base/common/uri.js';
import { WorkspaceService } from '../services/configuration/browser/configurationService.js';
import { ConfigurationCache } from '../services/configuration/common/configurationCache.js';
import { ISignService } from '../../platform/sign/common/sign.js';
Expand Down Expand Up @@ -182,8 +182,8 @@ export class BrowserMain extends Disposable {

return timerService.getPerformanceMarks();
},
async openUri(uri: URI): Promise<boolean> {
return openerService.open(uri, {});
async openUri(uri: URI | UriComponents): Promise<boolean> {
return openerService.open(URI.isUri(uri) ? uri : URI.from(uri), {});
}
},
logger: {
Expand Down
20 changes: 17 additions & 3 deletions vscode-web/src/vs/workbench/contrib/webview/browser/pre/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
const onElectron = searchParams.get('platform') === 'electron';
const disableServiceWorker = searchParams.has('disableServiceWorker');
const expectedWorkerVersion = parseInt(searchParams.get('swVersion'));
/** @type {MessageChannel | undefined} */
let outerIframeMessageChannel;

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

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

const postVersionMessage = (/** @type {ServiceWorker} */ controller) => {
controller.postMessage({ channel: 'version' });
outerIframeMessageChannel = new MessageChannel();
controller.postMessage({ channel: 'version' }, [outerIframeMessageChannel.port2]);
};

// At this point, either the service worker is ready and
Expand Down Expand Up @@ -1173,6 +1176,17 @@

unloadMonitor.onIframeLoaded(newFrame);
}

if (!disableServiceWorker && outerIframeMessageChannel) {
outerIframeMessageChannel.port1.onmessage = event => {
switch (event.data.channel) {
case 'load-resource':
case 'load-localhost':
hostMessaging.postMessage(event.data.channel, event.data);
return;
}
};
}
});

// propagate vscode-context-menu-visible class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,6 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
return this.fileService.writeFile(resource, readable, options);
}

getEncoding(resource: URI): string {
const model = resource.scheme === Schemas.untitled ? this.untitled.get(resource) : this.files.get(resource);
return model?.getEncoding() ?? this.encoding.getUnvalidatedEncodingForResource(resource);
}

async getEncodedReadable(resource: URI | undefined, value: ITextSnapshot): Promise<VSBufferReadable>;
async getEncodedReadable(resource: URI | undefined, value: string): Promise<VSBuffer | VSBufferReadable>;
async getEncodedReadable(resource: URI | undefined, value?: ITextSnapshot): Promise<VSBufferReadable | undefined>;
Expand Down Expand Up @@ -321,14 +316,37 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
candidateGuessEncodings:
options?.candidateGuessEncodings ||
this.textResourceConfigurationService.getValue(resource, 'files.candidateGuessEncodings'),
overwriteEncoding: async detectedEncoding => {
const { encoding } = await this.encoding.getPreferredReadEncoding(resource, options, detectedEncoding ?? undefined);

return encoding;
}
overwriteEncoding: async detectedEncoding => this.validateDetectedEncoding(resource, detectedEncoding ?? undefined, options)
});
}

getEncoding(resource: URI): string {
const model = resource.scheme === Schemas.untitled ? this.untitled.get(resource) : this.files.get(resource);
return model?.getEncoding() ?? this.encoding.getUnvalidatedEncodingForResource(resource);
}

async resolveDecoding(resource: URI | undefined, options?: IReadTextFileEncodingOptions): Promise<{ preferredEncoding: string; guessEncoding: boolean; candidateGuessEncodings: string[] }> {
return {
preferredEncoding: (await this.encoding.getPreferredReadEncoding(resource, options, undefined)).encoding,
guessEncoding:
options?.autoGuessEncoding ||
this.textResourceConfigurationService.getValue(resource, 'files.autoGuessEncoding'),
candidateGuessEncodings:
options?.candidateGuessEncodings ||
this.textResourceConfigurationService.getValue(resource, 'files.candidateGuessEncodings'),
};
}

async validateDetectedEncoding(resource: URI | undefined, detectedEncoding: string | undefined, options?: IReadTextFileEncodingOptions): Promise<string> {
const { encoding } = await this.encoding.getPreferredReadEncoding(resource, options, detectedEncoding);

return encoding;
}

resolveEncoding(resource: URI | undefined, options?: IWriteTextFileOptions): Promise<{ encoding: string; addBOM: boolean }> {
return this.encoding.getWriteEncoding(resource, options);
}

//#endregion


Expand Down
Loading