mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
move cli server and download command registrations out of api.impl
This commit is contained in:
@@ -6,25 +6,22 @@
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { tmpdir } from 'os';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { IExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { MainThreadDownloadServiceShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { MainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/rpcService';
|
||||
|
||||
export class ExtHostDownloadService extends Disposable {
|
||||
|
||||
static register(
|
||||
proxy: MainThreadDownloadServiceShape,
|
||||
commands: ExtHostCommands
|
||||
) {
|
||||
return new ExtHostDownloadService(proxy, commands);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
proxy: MainThreadDownloadServiceShape,
|
||||
commands: ExtHostCommands
|
||||
constructor(
|
||||
@IExtHostRpcService extHostRpc: IExtHostRpcService,
|
||||
@IExtHostCommands commands: IExtHostCommands
|
||||
) {
|
||||
super();
|
||||
|
||||
const proxy = extHostRpc.getProxy(MainContext.MainThreadDownloadService);
|
||||
|
||||
commands.registerCommand(false, '_workbench.downloadResource', async (resource: URI): Promise<any> => {
|
||||
const location = URI.file(join(tmpdir(), generateUuid()));
|
||||
await proxy.$download(resource, location);
|
||||
|
||||
Reference in New Issue
Block a user