@codingame/monaco-vscode-base-service-override 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __decorate, __param } from './external/tslib/tslib.es6.js';
1
2
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
2
3
  import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request';
3
4
  import { IDecorationsService } from 'vscode/vscode/vs/workbench/services/decorations/common/decorations';
@@ -16,7 +17,24 @@ import { ICanonicalUriService } from 'vscode/vscode/vs/platform/workspace/common
16
17
  import { IUserActivityService, UserActivityService } from 'vscode/vscode/vs/workbench/services/userActivity/common/userActivityService';
17
18
  import { IDownloadService } from 'vscode/vscode/vs/platform/download/common/download';
18
19
  import { DownloadService } from './vscode/src/vs/platform/download/common/downloadService.js';
20
+ import { IPathService, AbstractPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
21
+ import { IWorkingCopyFileService, WorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
22
+ import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
23
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
24
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
25
+ import { guessLocalUserHome } from './vscode/src/vs/workbench/services/path/browser/pathService.js';
26
+ import { getEnvironmentOverride } from 'vscode/workbench';
19
27
 
28
+ let BrowserPathServiceOverride = class BrowserPathServiceOverride extends AbstractPathService {
29
+ constructor(remoteAgentService, environmentService, contextService) {
30
+ super(getEnvironmentOverride().userHome ?? guessLocalUserHome(environmentService, contextService), remoteAgentService, environmentService, contextService);
31
+ }
32
+ };
33
+ BrowserPathServiceOverride = __decorate([
34
+ ( __param(0, IRemoteAgentService)),
35
+ ( __param(1, IWorkbenchEnvironmentService)),
36
+ ( __param(2, IWorkspaceContextService))
37
+ ], BrowserPathServiceOverride);
20
38
  function getServiceOverride() {
21
39
  return {
22
40
  [( IRequestService.toString())]: new SyncDescriptor(BrowserRequestService, [], true),
@@ -27,7 +45,9 @@ function getServiceOverride() {
27
45
  [( ITreeViewsService.toString())]: new SyncDescriptor(TreeviewsService, [], true),
28
46
  [( IURLService.toString())]: new SyncDescriptor(BrowserURLService, [], true),
29
47
  [( ICanonicalUriService.toString())]: new SyncDescriptor(CanonicalUriService, [], false),
30
- [( IUserActivityService.toString())]: new SyncDescriptor(UserActivityService, [], true)
48
+ [( IUserActivityService.toString())]: new SyncDescriptor(UserActivityService, [], true),
49
+ [( IWorkingCopyFileService.toString())]: new SyncDescriptor(WorkingCopyFileService, [], false),
50
+ [( IPathService.toString())]: new SyncDescriptor(BrowserPathServiceOverride, [], true)
31
51
  };
32
52
  }
33
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-base-service-override",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,6 +18,6 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@3.1.1"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@3.2.0"
22
22
  }
23
23
  }
@@ -0,0 +1,22 @@
1
+ import { AbstractPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
2
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
3
+ import { firstOrDefault } from 'vscode/vscode/vs/base/common/arrays';
4
+ import { dirname } from 'vscode/vscode/vs/base/common/resources';
5
+
6
+ function guessLocalUserHome(environmentService, contextService) {
7
+ const workspace = contextService.getWorkspace();
8
+ const firstFolder = firstOrDefault(workspace.folders);
9
+ if (firstFolder) {
10
+ return firstFolder.uri;
11
+ }
12
+ if (workspace.configuration) {
13
+ return dirname(workspace.configuration);
14
+ }
15
+ return ( URI.from({
16
+ scheme: AbstractPathService.findDefaultUriScheme(environmentService, contextService),
17
+ authority: environmentService.remoteAuthority,
18
+ path: '/'
19
+ }));
20
+ }
21
+
22
+ export { guessLocalUserHome };