mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-26 12:15:26 +00:00
Fix interactive playground
This commit is contained in:
parent
286f9a8978
commit
e22791ec88
@ -202,19 +202,20 @@ index e09049c5b9..d93ffa527a 100644
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts
|
||||
index 1986fb6642..7c66b644f2 100644
|
||||
index 1986fb6642..afbe385af6 100644
|
||||
--- a/src/vs/workbench/browser/web.main.ts
|
||||
+++ b/src/vs/workbench/browser/web.main.ts
|
||||
@@ -115,6 +115,8 @@ class CodeRendererMain extends Disposable {
|
||||
@@ -115,6 +115,9 @@ class CodeRendererMain extends Disposable {
|
||||
const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment()));
|
||||
|
||||
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
|
||||
+ fileService.registerProvider(Schemas.http, remoteFileSystemProvider);
|
||||
+ fileService.registerProvider(Schemas.https, remoteFileSystemProvider);
|
||||
+ fileService.registerProvider(Schemas.file, remoteFileSystemProvider);
|
||||
}
|
||||
|
||||
const payload = await this.resolveWorkspaceInitializationPayload();
|
||||
@@ -170,4 +172,4 @@ export function main(domElement: HTMLElement, options: IWorkbenchConstructionOpt
|
||||
@@ -170,4 +173,4 @@ export function main(domElement: HTMLElement, options: IWorkbenchConstructionOpt
|
||||
const renderer = new CodeRendererMain(domElement, options);
|
||||
|
||||
return renderer.open();
|
||||
|
@ -49,7 +49,10 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
|
||||
private readonly provider: DiskFileSystemProvider;
|
||||
private readonly watchers = new Map<string, Watcher>();
|
||||
|
||||
public constructor(private readonly logService: ILogService) {
|
||||
public constructor(
|
||||
private readonly environmentService: IEnvironmentService,
|
||||
private readonly logService: ILogService,
|
||||
) {
|
||||
this.provider = new DiskFileSystemProvider(this.logService);
|
||||
}
|
||||
|
||||
@ -113,11 +116,11 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
|
||||
}
|
||||
|
||||
private async stat(resource: UriComponents): Promise<IStat> {
|
||||
return this.provider.stat(URI.from(resource));
|
||||
return this.provider.stat(this.transform(resource));
|
||||
}
|
||||
|
||||
private async open(resource: UriComponents, opts: FileOpenOptions): Promise<number> {
|
||||
return this.provider.open(URI.from(resource), opts);
|
||||
return this.provider.open(this.transform(resource), opts);
|
||||
}
|
||||
|
||||
private async close(fd: number): Promise<void> {
|
||||
@ -135,32 +138,40 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
|
||||
}
|
||||
|
||||
private async delete(resource: UriComponents, opts: FileDeleteOptions): Promise<void> {
|
||||
return this.provider.delete(URI.from(resource), opts);
|
||||
return this.provider.delete(this.transform(resource), opts);
|
||||
}
|
||||
|
||||
private async mkdir(resource: UriComponents): Promise<void> {
|
||||
return this.provider.mkdir(URI.from(resource));
|
||||
return this.provider.mkdir(this.transform(resource));
|
||||
}
|
||||
|
||||
private async readdir(resource: UriComponents): Promise<[string, FileType][]> {
|
||||
return this.provider.readdir(URI.from(resource));
|
||||
return this.provider.readdir(this.transform(resource));
|
||||
}
|
||||
|
||||
private async rename(resource: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise<void> {
|
||||
return this.provider.rename(URI.from(resource), URI.from(target), opts);
|
||||
return this.provider.rename(this.transform(resource), URI.from(target), opts);
|
||||
}
|
||||
|
||||
private copy(resource: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise<void> {
|
||||
return this.provider.copy(URI.from(resource), URI.from(target), opts);
|
||||
return this.provider.copy(this.transform(resource), URI.from(target), opts);
|
||||
}
|
||||
|
||||
private async watch(session: string, req: number, resource: UriComponents, opts: IWatchOptions): Promise<void> {
|
||||
this.watchers.get(session)!._watch(req, URI.from(resource), opts);
|
||||
this.watchers.get(session)!._watch(req, this.transform(resource), opts);
|
||||
}
|
||||
|
||||
private async unwatch(session: string, req: number): Promise<void> {
|
||||
this.watchers.get(session)!.unwatch(req);
|
||||
}
|
||||
|
||||
private transform(resource: UriComponents): URI {
|
||||
// HACK: for now assume /out is relative to the build.
|
||||
if (resource.path.indexOf("/out") === 0) {
|
||||
resource.path = this.environmentService.appRoot + resource.path;
|
||||
}
|
||||
return URI.from(resource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -402,7 +402,7 @@ export class MainServer extends Server {
|
||||
|
||||
instantiationService.invokeFunction(() => {
|
||||
instantiationService.createInstance(LogsDataCleaner);
|
||||
this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(logService));
|
||||
this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(environmentService, logService));
|
||||
this.ipc.registerChannel("remoteextensionsenvironment", new ExtensionEnvironmentChannel(environmentService, logService));
|
||||
const extensionsService = this.services.get(IExtensionManagementService) as IExtensionManagementService;
|
||||
const extensionsChannel = new ExtensionManagementChannel(extensionsService, (context) => getUriTransformer(context.remoteAuthority));
|
||||
|
Loading…
Reference in New Issue
Block a user