code-server/packages/vscode/src/fill/workspacesService.ts
Kyle Carberry 85d2225e0c Featureful (#31)
* Fix loading within the CLI

* Remove app

* Remove promise handle

* Add initial travis file

* Add libxkbfile dependency

* Add libxkbfile-dev

* Add build script

* Fix malformed bash statement

* Remove yarn from script

* Improve build script

* Extract upx before usage

* Only run upx if on linux

* Ensure resource directory exists

* Pack runnable binary

* Export binary with platform

* Improve build process

* Install upx before running install script

* Update typescript version before running nexe

* Add os.release() function for multi-platform support

* Update travis.yml to improve deployment

* Add on CI

* Update to v1.31.0

* Add libsecret

* Update build target

* Skip cleanup

* Fix built-in extensions

* Add basics for apps

* Create custom DNS server

* Fix forking within CLI. Fixes TS language features

* Fix filename resolve

* Fix default extensions path

* Add custom dialog

* Store workspace path

* Remove outfiles

* Cleanup

* Always authed outside of CLI

* Use location.host for client

* Remove useless app interface

* Remove debug file for building wordlist

* Use chromes tcp host

* Update patch

* Build browser app before packaging

* Replace all css containing file:// URLs, fix webviews

* Fix save

* Fix mkdir
2019-02-21 11:55:42 -06:00

41 lines
1.7 KiB
TypeScript

import { URI } from "vs/base/common/uri";
import { IEnvironmentService } from "vs/platform/environment/common/environment";
import { ILogService } from "vs/platform/log/common/log";
import { IWorkspaceFolderCreationData, IWorkspaceIdentifier, IWorkspacesService } from "vs/platform/workspaces/common/workspaces";
import { WorkspacesMainService } from "vs/platform/workspaces/electron-main/workspacesMainService";
import * as workspacesIpc from "vs/platform/workspaces/node/workspacesIpc";
import { client } from "../client";
/**
* Instead of going to the shared process, we'll directly run these methods on
* the client. This setup means we can only control the current window.
*/
class WorkspacesService implements IWorkspacesService {
// tslint:disable-next-line:no-any
public _serviceBrand: any;
public createUntitledWorkspace(folders?: IWorkspaceFolderCreationData[] | undefined): Promise<IWorkspaceIdentifier> {
const mainService = new WorkspacesMainService(
client.serviceCollection.get<IEnvironmentService>(IEnvironmentService) as IEnvironmentService,
client.serviceCollection.get<ILogService>(ILogService) as ILogService,
);
// lib/vscode/src/vs/platform/workspaces/node/workspacesIpc.ts
const rawFolders: IWorkspaceFolderCreationData[] = folders!;
if (Array.isArray(rawFolders)) {
folders = rawFolders.map(rawFolder => {
return {
uri: URI.revive(rawFolder.uri), // convert raw URI back to real URI
name: rawFolder.name!,
} as IWorkspaceFolderCreationData;
});
}
return mainService.createUntitledWorkspace(folders);
}
}
const target = workspacesIpc as typeof workspacesIpc;
// @ts-ignore TODO: don't ignore it.
target.WorkspacesChannelClient = WorkspacesService;