feat: apply patch after setting up subtree
This commit is contained in:
@@ -61,6 +61,7 @@ import './mainThreadComments';
|
||||
import './mainThreadNotebook';
|
||||
import './mainThreadTask';
|
||||
import './mainThreadLabelService';
|
||||
import 'vs/server/browser/mainThreadNodeProxy';
|
||||
import './mainThreadTunnelService';
|
||||
import './mainThreadAuthentication';
|
||||
import './mainThreadTimeline';
|
||||
|
||||
@@ -62,11 +62,11 @@ export class MainThreadStorage implements MainThreadStorageShape {
|
||||
return JSON.parse(jsonValue);
|
||||
}
|
||||
|
||||
$setValue(shared: boolean, key: string, value: object): Promise<void> {
|
||||
async $setValue(shared: boolean, key: string, value: object): Promise<void> {
|
||||
let jsonValue: string;
|
||||
try {
|
||||
jsonValue = JSON.stringify(value);
|
||||
this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
await this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransf
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
|
||||
import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy';
|
||||
import { ExtHostTheming } from 'vs/workbench/api/common/extHostTheming';
|
||||
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
|
||||
import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
|
||||
@@ -103,6 +104,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const extHostStorage = accessor.get(IExtHostStorage);
|
||||
const extensionStoragePaths = accessor.get(IExtensionStoragePaths);
|
||||
const extHostLogService = accessor.get(ILogService);
|
||||
const extHostNodeProxy = accessor.get(IExtHostNodeProxy);
|
||||
const extHostTunnelService = accessor.get(IExtHostTunnelService);
|
||||
const extHostApiDeprecation = accessor.get(IExtHostApiDeprecationService);
|
||||
const extHostWindow = accessor.get(IExtHostWindow);
|
||||
@@ -114,6 +116,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostNodeProxy, extHostNodeProxy);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostTunnelService, extHostTunnelService);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostWindow, extHostWindow);
|
||||
|
||||
|
||||
@@ -816,6 +816,17 @@ export interface MainThreadLabelServiceShape extends IDisposable {
|
||||
$unregisterResourceLabelFormatter(handle: number): void;
|
||||
}
|
||||
|
||||
export interface MainThreadNodeProxyShape extends IDisposable {
|
||||
$send(message: string): void;
|
||||
$fetchExtension(extensionUri: UriComponents): Promise<VSBuffer>;
|
||||
}
|
||||
export interface ExtHostNodeProxyShape {
|
||||
$onMessage(message: string): void;
|
||||
$onClose(): void;
|
||||
$onDown(): void;
|
||||
$onUp(): void;
|
||||
}
|
||||
|
||||
export interface MainThreadSearchShape extends IDisposable {
|
||||
$registerFileSearchProvider(handle: number, scheme: string): void;
|
||||
$registerTextSearchProvider(handle: number, scheme: string): void;
|
||||
@@ -1796,6 +1807,7 @@ export const MainContext = {
|
||||
MainThreadWindow: createMainId<MainThreadWindowShape>('MainThreadWindow'),
|
||||
MainThreadLabelService: createMainId<MainThreadLabelServiceShape>('MainThreadLabelService'),
|
||||
MainThreadNotebook: createMainId<MainThreadNotebookShape>('MainThreadNotebook'),
|
||||
MainThreadNodeProxy: createMainId<MainThreadNodeProxyShape>('MainThreadNodeProxy'),
|
||||
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
|
||||
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
|
||||
MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline')
|
||||
@@ -1838,6 +1850,7 @@ export const ExtHostContext = {
|
||||
ExtHostOutputService: createMainId<ExtHostOutputServiceShape>('ExtHostOutputService'),
|
||||
ExtHosLabelService: createMainId<ExtHostLabelServiceShape>('ExtHostLabelService'),
|
||||
ExtHostNotebook: createMainId<ExtHostNotebookShape>('ExtHostNotebook'),
|
||||
ExtHostNodeProxy: createMainId<ExtHostNodeProxyShape>('ExtHostNodeProxy'),
|
||||
ExtHostTheming: createMainId<ExtHostThemingShape>('ExtHostTheming'),
|
||||
ExtHostTunnelService: createMainId<ExtHostTunnelServiceShape>('ExtHostTunnelService'),
|
||||
ExtHostAuthentication: createMainId<ExtHostAuthenticationShape>('ExtHostAuthentication'),
|
||||
|
||||
@@ -31,6 +31,7 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
|
||||
import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy';
|
||||
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
|
||||
import { IExtHostTerminalService } from 'vs/workbench/api/common/extHostTerminalService';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -82,6 +83,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
||||
protected readonly _extHostWorkspace: ExtHostWorkspace;
|
||||
protected readonly _extHostConfiguration: ExtHostConfiguration;
|
||||
protected readonly _logService: ILogService;
|
||||
protected readonly _nodeProxy: IExtHostNodeProxy;
|
||||
protected readonly _extHostTunnelService: IExtHostTunnelService;
|
||||
protected readonly _extHostTerminalService: IExtHostTerminalService;
|
||||
|
||||
@@ -114,6 +116,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
||||
@ILogService logService: ILogService,
|
||||
@IExtHostInitDataService initData: IExtHostInitDataService,
|
||||
@IExtensionStoragePaths storagePath: IExtensionStoragePaths,
|
||||
@IExtHostNodeProxy nodeProxy: IExtHostNodeProxy,
|
||||
@IExtHostTunnelService extHostTunnelService: IExtHostTunnelService,
|
||||
@IExtHostTerminalService extHostTerminalService: IExtHostTerminalService
|
||||
) {
|
||||
@@ -125,6 +128,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
||||
this._extHostWorkspace = extHostWorkspace;
|
||||
this._extHostConfiguration = extHostConfiguration;
|
||||
this._logService = logService;
|
||||
this._nodeProxy = nodeProxy;
|
||||
this._extHostTunnelService = extHostTunnelService;
|
||||
this._extHostTerminalService = extHostTerminalService;
|
||||
this._disposables = new DisposableStore();
|
||||
@@ -362,7 +366,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
||||
|
||||
const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup);
|
||||
return Promise.all([
|
||||
this._loadCommonJSModule<IExtensionModule>(joinPath(extensionDescription.extensionLocation, entryPoint), activationTimesBuilder),
|
||||
this._loadCommonJSModule<IExtensionModule>(joinPath(extensionDescription.extensionLocation, entryPoint), activationTimesBuilder, !extensionDescription.browser),
|
||||
this._loadExtensionContext(extensionDescription)
|
||||
]).then(values => {
|
||||
return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder);
|
||||
@@ -754,7 +758,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
||||
|
||||
protected abstract _beforeAlmostReadyToRunExtensions(): Promise<void>;
|
||||
protected abstract _getEntryPoint(extensionDescription: IExtensionDescription): string | undefined;
|
||||
protected abstract _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T>;
|
||||
protected abstract _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder, isRemote?: boolean): Promise<T>;
|
||||
public abstract $setRemoteEnvironment(env: { [key: string]: string | null }): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy';
|
||||
import { NotImplementedProxy } from 'vs/base/common/types';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { ExtHostOutputService2 } from 'vs/workbench/api/node/extHostOutputService';
|
||||
import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService';
|
||||
@@ -36,3 +38,4 @@ registerSingleton(IExtHostSearch, NativeExtHostSearch);
|
||||
registerSingleton(IExtHostTask, ExtHostTask);
|
||||
registerSingleton(IExtHostTerminalService, ExtHostTerminalService);
|
||||
registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
|
||||
registerSingleton(IExtHostNodeProxy, class extends NotImplementedProxy<IExtHostNodeProxy>(String(IExtHostNodeProxy)) { whenReady = Promise.resolve(); });
|
||||
|
||||
@@ -11,6 +11,8 @@ import { IWindowOpenable, IOpenWindowOptions } from 'vs/platform/windows/common/
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { tmpdir } from 'os';
|
||||
|
||||
export interface OpenCommandPipeArgs {
|
||||
type: 'open';
|
||||
@@ -58,6 +60,11 @@ export class CLIServerBase {
|
||||
}
|
||||
|
||||
private async setup(): Promise<string> {
|
||||
// NOTE@coder: Write this out so we can get the most recent path.
|
||||
fs.promises.writeFile(join(tmpdir(), 'vscode-ipc'), this._ipcHandlePath).catch((error) => {
|
||||
this.logService.error(error);
|
||||
});
|
||||
|
||||
try {
|
||||
this._server.listen(this.ipcHandlePath);
|
||||
this._server.on('error', err => this.logService.error(err));
|
||||
|
||||
@@ -8,6 +8,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensionService';
|
||||
import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
|
||||
import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy';
|
||||
|
||||
// #########################################################################
|
||||
// ### ###
|
||||
@@ -17,3 +18,4 @@ import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
|
||||
|
||||
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
|
||||
registerSingleton(ILogService, ExtHostLogService);
|
||||
registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterc
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionRuntime } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { loadCommonJSModule } from 'vs/server/browser/worker';
|
||||
|
||||
class WorkerRequireInterceptor extends RequireInterceptor {
|
||||
|
||||
@@ -46,10 +47,15 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
|
||||
}
|
||||
|
||||
protected _getEntryPoint(extensionDescription: IExtensionDescription): string | undefined {
|
||||
return extensionDescription.browser;
|
||||
// NOTE@coder: We can support regular Node modules as well. These will just
|
||||
// require the root of the extension.
|
||||
return extensionDescription.browser || '.';
|
||||
}
|
||||
|
||||
protected async _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
|
||||
protected async _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder, isRemote?: boolean): Promise<T> {
|
||||
if (isRemote) {
|
||||
return loadCommonJSModule(module, activationTimesBuilder, this._nodeProxy, this._logService, this._fakeModules!.getModule('vscode', module));
|
||||
}
|
||||
|
||||
module = module.with({ path: ensureSuffix(module.path, '.js') });
|
||||
const response = await fetch(module.toString(true));
|
||||
|
||||
@@ -311,3 +311,6 @@ actionsRegistry.registerWorkbenchAction(SyncActionDescriptor.from(FocusPreviousP
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(GoHomeContributor, LifecyclePhase.Ready);
|
||||
export const _1 = workbenchRegistry;
|
||||
export const _2 = GoHomeContributor;
|
||||
export const _3 = LifecyclePhase.Ready;
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
order: -1;
|
||||
|
||||
/* NOTE@coder: Hide since it doesn't seem to do anything when used with
|
||||
code-server except open the VS Code repository. */
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.monaco-workbench .activitybar > .content > .home-bar > .home-bar-icon-badge {
|
||||
|
||||
@@ -43,6 +43,7 @@ import { FileLogService } from 'vs/platform/log/common/fileLogService';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { getWorkspaceIdentifier } from 'vs/workbench/services/workspaces/browser/workspaces';
|
||||
import { initialize } from 'vs/server/browser/client';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
@@ -101,6 +102,8 @@ class BrowserMain extends Disposable {
|
||||
// Startup
|
||||
const instantiationService = workbench.startup();
|
||||
|
||||
await initialize(services.serviceCollection);
|
||||
|
||||
// Return API Facade
|
||||
return instantiationService.invokeFunction(accessor => {
|
||||
const commandService = accessor.get(ICommandService);
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ParsedExpression, IExpression, parse } from 'vs/base/common/glob';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
export class ResourceContextKey extends Disposable implements IContextKey<URI> {
|
||||
|
||||
@@ -74,7 +75,8 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
|
||||
if (!ResourceContextKey._uriEquals(this._resourceKey.get(), value)) {
|
||||
this._contextKeyService.bufferChangeEvents(() => {
|
||||
this._resourceKey.set(value);
|
||||
this._schemeKey.set(value ? value.scheme : null);
|
||||
// NOTE@coder: Fixes source control context menus (#1104).
|
||||
this._schemeKey.set(value ? (value.scheme === Schemas.vscodeRemote ? Schemas.file : value.scheme) : null);
|
||||
this._filenameKey.set(value ? basename(value) : null);
|
||||
this._dirnameKey.set(value ? dirname(value).fsPath : null);
|
||||
this._pathKey.set(value ? value.fsPath : null);
|
||||
|
||||
@@ -778,17 +778,30 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
|
||||
}
|
||||
switch (e.type) {
|
||||
case PersistentConnectionEventType.ConnectionLost:
|
||||
break;
|
||||
case PersistentConnectionEventType.ReconnectionWait:
|
||||
const BACKGROUND_RECONNECT_THRESHOLD = 2;
|
||||
// If the first reconnect fails, we show the popup.
|
||||
// This corresponds to about 5s wait.
|
||||
if (e.connectionAttempt < BACKGROUND_RECONNECT_THRESHOLD) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!visibleProgress) {
|
||||
visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
|
||||
}
|
||||
visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
|
||||
break;
|
||||
case PersistentConnectionEventType.ReconnectionWait:
|
||||
|
||||
reconnectWaitEvent = e;
|
||||
visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
|
||||
visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
|
||||
break;
|
||||
case PersistentConnectionEventType.ReconnectionRunning:
|
||||
if (!visibleProgress) {
|
||||
// Our background reconnection threshold hasn't been hit yet.
|
||||
break;
|
||||
}
|
||||
|
||||
visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
|
||||
visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
|
||||
|
||||
|
||||
@@ -149,9 +149,11 @@
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.scm-view .monaco-list .monaco-list-row .resource > .name > .monaco-icon-label > .actions {
|
||||
flex-grow: 100;
|
||||
}
|
||||
/* NOTE@coder: Causes the label to shrink to zero width in Firefox due to
|
||||
* overflow:hidden. This isn't right anyway, as far as I can tell. */
|
||||
/* .scm-view .monaco-list .monaco-list-row .resource > .name > .monaco-icon-label > .actions { */
|
||||
/* flex-grow: 100; */
|
||||
/* } */
|
||||
|
||||
.scm-view .monaco-list .monaco-list-row .resource-group > .actions,
|
||||
.scm-view .monaco-list .monaco-list-row .resource > .name > .monaco-icon-label > .actions {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
export default () => `
|
||||
@@ -11,7 +12,7 @@ export default () => `
|
||||
<div class="welcomePage" role="document">
|
||||
<div class="title">
|
||||
<h1 class="caption">${escape(localize('welcomePage.vscode', "Visual Studio Code"))}</h1>
|
||||
<p class="subtitle detail">${escape(localize({ key: 'welcomePage.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))}</p>
|
||||
<p class="subtitle detail">VS Code v${product.version}</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="splash">
|
||||
@@ -32,6 +33,19 @@ export default () => `
|
||||
</ul>
|
||||
<p class="none detail">${escape(localize('welcomePage.noRecentFolders', "No recent folders"))}</p>
|
||||
</div>
|
||||
<div class="section help">
|
||||
<h2 class="caption">code-server ${escape(localize('welcomePage.help', "Help"))}</h2>
|
||||
<ul>
|
||||
<li><a href="https://github.com/cdr/code-server">GitHub Repository</a></li>
|
||||
<li><a href="https://github.com/cdr/code-server/releases/tag/v${product.codeServerVersion}">Release Notes</a></li>
|
||||
<li><a href="https://github.com/cdr/code-server/issues">Issue Tracker</a></li>
|
||||
<li><a href="https://github.com/cdr/code-server/blob/master/doc/FAQ.md">FAQ</a></li>
|
||||
<li><a href="https://github.com/cdr/code-server/blob/master/doc/guide.md">Setup Guide</a></li>
|
||||
<li><a href="https://github.com/cdr/code-server/tree/master/doc">Docs</a></li>
|
||||
<li><a href="https://github.com/cdr/code-server/discussions">Discussions</a></li>
|
||||
<li><a href="https://cdr.co/join-community">Slack</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section help">
|
||||
<h2 class="caption">${escape(localize('welcomePage.help', "Help"))}</h2>
|
||||
<ul>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .welcomePage .splash .section {
|
||||
margin-bottom: 5em;
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
.monaco-workbench .part.editor > .content .welcomePage .splash ul {
|
||||
|
||||
@@ -328,7 +328,7 @@ class WelcomePage extends Disposable {
|
||||
|
||||
const prodName = container.querySelector('.welcomePage .title .caption') as HTMLElement;
|
||||
if (prodName) {
|
||||
prodName.textContent = this.productService.nameLong;
|
||||
prodName.textContent = `code-server v${this.productService.codeServerVersion}`;
|
||||
}
|
||||
|
||||
recentlyOpened.then(({ workspaces }) => {
|
||||
|
||||
@@ -130,6 +130,8 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
|
||||
extensionsPath?: string | undefined;
|
||||
extensionsDownloadPath: string = undefined!;
|
||||
builtinExtensionsPath: string = undefined!;
|
||||
extraExtensionPaths: string[] = undefined!;
|
||||
extraBuiltinExtensionPaths: string[] = undefined!;
|
||||
|
||||
driverHandle?: string | undefined;
|
||||
|
||||
|
||||
@@ -125,11 +125,12 @@ export class DialogService implements IDialogService {
|
||||
async about(): Promise<void> {
|
||||
const detailString = (useAgo: boolean): string => {
|
||||
return nls.localize('aboutDetail',
|
||||
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
||||
"code-server: v{4}\n VS Code: v{0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
||||
this.productService.version || 'Unknown',
|
||||
this.productService.commit || 'Unknown',
|
||||
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
|
||||
navigator.userAgent
|
||||
navigator.userAgent,
|
||||
this.productService.codeServerVersion || 'Unknown',
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -119,8 +119,25 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
@memoize
|
||||
get logFile(): URI { return joinPath(this.options.logsPath, 'window.log'); }
|
||||
|
||||
// NOTE@coder: Use the same path in // ../../../../platform/environment/node/environmentService.ts
|
||||
// and don't use the user data scheme. This solves two problems:
|
||||
// 1. Extensions running in the browser (like Vim) might use these paths
|
||||
// directly instead of using the file service and most likely can't write
|
||||
// to `/User` on disk.
|
||||
// 2. Settings will be stored in the file system instead of in browser
|
||||
// storage. Using browser storage makes sharing or seeding settings
|
||||
// between browsers difficult. We may want to revisit this once/if we get
|
||||
// settings sync.
|
||||
@memoize
|
||||
get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.userData }); }
|
||||
get userRoamingDataHome(): URI { return joinPath(URI.file(this.userDataPath).with({ scheme: Schemas.vscodeRemote }), 'User'); }
|
||||
@memoize
|
||||
get userDataPath(): string {
|
||||
const dataPath = this.payload?.get('userDataPath');
|
||||
if (!dataPath) {
|
||||
throw new Error('userDataPath was not provided to environment service');
|
||||
}
|
||||
return dataPath;
|
||||
}
|
||||
|
||||
@memoize
|
||||
get settingsResource(): URI { return joinPath(this.userRoamingDataHome, 'settings.json'); }
|
||||
@@ -301,7 +318,12 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
extensionHostDebugEnvironment.params.port = parseInt(value);
|
||||
break;
|
||||
case 'enableProposedApi':
|
||||
extensionHostDebugEnvironment.extensionEnabledProposedApi = [];
|
||||
try {
|
||||
extensionHostDebugEnvironment.extensionEnabledProposedApi = JSON.parse(value);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
extensionHostDebugEnvironment.extensionEnabledProposedApi = [];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false; // NOTE@coder: Don't disable anything by extensionKind.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,9 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
|
||||
|
||||
// Install Language pack on all servers
|
||||
if (isLanguagePackExtension(manifest)) {
|
||||
servers.push(...this.servers);
|
||||
// NOTE@coder: It does not appear language packs can be installed on the web
|
||||
// extension management server at this time. Filter out the web to fix this.
|
||||
servers.push(...this.servers.filter(s => s !== this.extensionManagementServerService.webExtensionManagementServer));
|
||||
} else {
|
||||
const server = this.getExtensionManagementServerToInstall(manifest);
|
||||
if (server) {
|
||||
@@ -320,6 +322,11 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
|
||||
return this.extensionManagementServerService.webExtensionManagementServer;
|
||||
}
|
||||
|
||||
// NOTE@coder: Fall back to installing on the remote server.
|
||||
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
|
||||
return this.extensionManagementServerService.remoteExtensionManagementServer;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
if (code === ExtensionHostExitCode.StartTimeout10s) {
|
||||
this._notificationService.prompt(
|
||||
Severity.Error,
|
||||
nls.localize('extensionService.startTimeout', "The Web Worker Extension Host did not start in 10s."),
|
||||
nls.localize('extensionService.startTimeout', 'The Web Worker Extension Host did not start in 10s.'),
|
||||
[]
|
||||
);
|
||||
return;
|
||||
@@ -177,8 +177,10 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
this._remoteAgentService.getEnvironment(),
|
||||
this._remoteAgentService.scanExtensions()
|
||||
]);
|
||||
localExtensions = this._checkEnabledAndProposedAPI(localExtensions);
|
||||
remoteExtensions = this._checkEnabledAndProposedAPI(remoteExtensions);
|
||||
// NOTE@coder: Include remotely hosted extensions that should run locally.
|
||||
localExtensions = this._checkEnabledAndProposedAPI(localExtensions)
|
||||
.concat(remoteExtensions.filter(ext => !ext.browser && ext.extensionKind && (ext.extensionKind === 'web' || ext.extensionKind.includes('web'))));
|
||||
|
||||
const remoteAgentConnection = this._remoteAgentService.getConnection();
|
||||
this._runningLocation = this._runningLocationClassifier.determineRunningLocation(localExtensions, remoteExtensions);
|
||||
@@ -188,7 +190,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
|
||||
const result = this._registry.deltaExtensions(remoteExtensions.concat(localExtensions), []);
|
||||
if (result.removedDueToLooping.length > 0) {
|
||||
this._logOrShowMessage(Severity.Error, nls.localize('looping', "The following extensions contain dependency loops and have been disabled: {0}", result.removedDueToLooping.map(e => `'${e.identifier.value}'`).join(', ')));
|
||||
this._logOrShowMessage(Severity.Error, nls.localize('looping', 'The following extensions contain dependency loops and have been disabled: {0}', result.removedDueToLooping.map(e => `'${e.identifier.value}'`).join(', ')));
|
||||
}
|
||||
|
||||
if (remoteEnv && remoteAgentConnection) {
|
||||
|
||||
@@ -37,7 +37,8 @@ export function canExecuteOnWorkspace(manifest: IExtensionManifest, productServi
|
||||
|
||||
export function canExecuteOnWeb(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean {
|
||||
const extensionKind = getExtensionKind(manifest, productService, configurationService);
|
||||
return extensionKind.some(kind => kind === 'web');
|
||||
// NOTE@coder: Hardcode vim for now.
|
||||
return extensionKind.some(kind => kind === 'web') || manifest.name === 'vim';
|
||||
}
|
||||
|
||||
export function getExtensionKind(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): ExtensionKind[] {
|
||||
|
||||
@@ -16,11 +16,12 @@ import { IInitData } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { MessageType, createMessageOfType, isMessageOfType, IExtHostSocketMessage, IExtHostReadyMessage, IExtHostReduceGraceTimeMessage, ExtensionHostExitCode } from 'vs/workbench/services/extensions/common/extensionHostProtocol';
|
||||
import { ExtensionHostMain, IExitFn } from 'vs/workbench/services/extensions/common/extensionHostMain';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { IURITransformer, URITransformer, IRawURITransformer } from 'vs/base/common/uriIpc';
|
||||
import { IURITransformer, URITransformer } from 'vs/base/common/uriIpc';
|
||||
import { exists } from 'vs/base/node/pfs';
|
||||
import { realpath } from 'vs/base/node/extpath';
|
||||
import { IHostUtils } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import * as proxyAgent from 'vs/base/node/proxy_agent';
|
||||
|
||||
import 'vs/workbench/api/common/extHost.common.services';
|
||||
import 'vs/workbench/api/node/extHost.node.services';
|
||||
@@ -57,12 +58,13 @@ const args = minimist(process.argv.slice(2), {
|
||||
const Module = require.__$__nodeRequire('module') as any;
|
||||
const originalLoad = Module._load;
|
||||
|
||||
Module._load = function (request: string) {
|
||||
Module._load = function (request: string, parent: object, isMain: boolean) {
|
||||
if (request === 'natives') {
|
||||
throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more');
|
||||
}
|
||||
|
||||
return originalLoad.apply(this, arguments);
|
||||
// NOTE@coder: Map node_module.asar requests to regular node_modules.
|
||||
return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]);
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -135,8 +137,11 @@ function _createExtHostProtocol(): Promise<PersistentProtocol> {
|
||||
|
||||
// Wait for rich client to reconnect
|
||||
protocol.onSocketClose(() => {
|
||||
// The socket has closed, let's give the renderer a certain amount of time to reconnect
|
||||
disconnectRunner1.schedule();
|
||||
// NOTE@coder: Inform the server so we can manage offline
|
||||
// connections there instead. Our goal is to persist connections
|
||||
// forever (to a reasonable point) to account for things like
|
||||
// hibernating overnight.
|
||||
process.send!({ type: 'VSCODE_EXTHOST_DISCONNECTED' });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -295,6 +300,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
|
||||
}
|
||||
|
||||
export async function startExtensionHostProcess(): Promise<void> {
|
||||
proxyAgent.monkeyPatch(true);
|
||||
|
||||
const protocol = await createExtHostProtocol();
|
||||
const renderer = await connectToRenderer(protocol);
|
||||
@@ -313,11 +319,9 @@ export async function startExtensionHostProcess(): Promise<void> {
|
||||
|
||||
// Attempt to load uri transformer
|
||||
let uriTransformer: IURITransformer | null = null;
|
||||
if (initData.remote.authority && args.uriTransformerPath) {
|
||||
if (initData.remote.authority) {
|
||||
try {
|
||||
const rawURITransformerFactory = <any>require.__$__nodeRequire(args.uriTransformerPath);
|
||||
const rawURITransformer = <IRawURITransformer>rawURITransformerFactory(initData.remote.authority);
|
||||
uriTransformer = new URITransformer(rawURITransformer);
|
||||
uriTransformer = new URITransformer(initData.remote.authority);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
require.config({
|
||||
baseUrl: monacoBaseUrl,
|
||||
catchError: true,
|
||||
createTrustedScriptURL: (value: string) => value
|
||||
createTrustedScriptURL: (value: string) => value,
|
||||
paths: {
|
||||
'@coder/node-browser': `../node_modules/@coder/node-browser/out/client/client.js`,
|
||||
'@coder/requirefs': `../node_modules/@coder/requirefs/out/requirefs.js`,
|
||||
}
|
||||
});
|
||||
|
||||
require(['vs/workbench/services/extensions/worker/extensionHostWorker'], () => { }, err => console.error(err));
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
import { createChannelSender } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
|
||||
// @ts-ignore: interface is implemented via proxy
|
||||
export class LocalizationsService implements ILocalizationsService {
|
||||
@@ -14,9 +14,9 @@ export class LocalizationsService implements ILocalizationsService {
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
constructor(
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService,
|
||||
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
|
||||
) {
|
||||
return createChannelSender<ILocalizationsService>(sharedProcessService.getChannel('localizations'));
|
||||
return createChannelSender<ILocalizationsService>(remoteAgentService.getConnection()!.getChannel('localizations'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ import 'vs/workbench/services/textfile/browser/browserTextFileService';
|
||||
import 'vs/workbench/services/keybinding/browser/keymapService';
|
||||
import 'vs/workbench/services/extensions/browser/extensionService';
|
||||
import 'vs/workbench/services/extensionManagement/common/extensionManagementServerService';
|
||||
import 'vs/workbench/services/telemetry/browser/telemetryService';
|
||||
// NOTE@coder: We send it all to the server side to be processed there instead.
|
||||
// import 'vs/workbench/services/telemetry/browser/telemetryService';
|
||||
import 'vs/workbench/services/configurationResolver/browser/configurationResolverService';
|
||||
import 'vs/workbench/services/credentials/browser/credentialsService';
|
||||
import 'vs/workbench/services/url/browser/urlService';
|
||||
|
||||
Reference in New Issue
Block a user