@codingame/monaco-vscode-configuration-service-override 4.1.0 → 4.1.2

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/configuration.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { __decorate, __param } from './external/tslib/tslib.es6.js';
2
- import { WorkspaceService } from 'vscode/vscode/vs/workbench/services/configuration/browser/configurationService';
2
+ import { WorkspaceService } from './vscode/src/vs/workbench/services/configuration/browser/configurationService.js';
3
3
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
4
4
  import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
5
- import { TextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfigurationService';
5
+ import { TextResourceConfigurationService } from './vscode/src/vs/editor/common/services/textResourceConfigurationService.js';
6
6
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
7
7
  import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
8
8
  export { ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
@@ -20,22 +20,22 @@ import { ConfigurationCache } from './vscode/src/vs/workbench/services/configura
20
20
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
21
21
  import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
22
22
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
23
- import { LabelService } from 'vscode/vscode/vs/workbench/services/label/common/labelService';
23
+ import { LabelService } from './vscode/src/vs/workbench/services/label/common/labelService.js';
24
24
  import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
25
25
  import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
26
26
  import { IWorkspacesService } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
27
- import { BrowserWorkspacesService } from 'vscode/vscode/vs/workbench/services/workspaces/browser/workspacesService';
27
+ import { BrowserWorkspacesService } from './vscode/src/vs/workbench/services/workspaces/browser/workspacesService.js';
28
28
  import { IWorkspaceEditingService } from 'vscode/vscode/vs/workbench/services/workspaces/common/workspaceEditing';
29
- import { AbstractWorkspaceEditingService } from 'vscode/vscode/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService';
29
+ import { AbstractWorkspaceEditingService } from './vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js';
30
30
  import { URI } from 'vscode/vscode/vs/base/common/uri';
31
- import 'vscode/vscode/vs/workbench/api/common/configurationExtensionPoint';
32
- import { TextResourcePropertiesService } from 'vscode/vscode/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService';
31
+ import './vscode/src/vs/workbench/api/common/configurationExtensionPoint.js';
32
+ import { TextResourcePropertiesService } from './vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.js';
33
33
  import getServiceOverride$1, { initFile } from '@codingame/monaco-vscode-files-service-override';
34
34
  import { memoizedConstructor, unsupported } from './tools.js';
35
35
  import { registerServiceInitializePreParticipant } from 'vscode/lifecycle';
36
36
  import { getService, withReadyServices } from 'vscode/services';
37
37
  import { getWorkspaceIdentifier } from 'vscode/workbench';
38
- import 'vscode/vscode/vs/workbench/contrib/workspaces/browser/workspaces.contribution';
38
+ import './vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.js';
39
39
 
40
40
  const defaultUserConfigurationFile = ( URI.from({ scheme: Schemas.vscodeUserData, path: '/User/settings.json' }));
41
41
  async function initUserConfiguration(configurationJson, options, file = defaultUserConfigurationFile) {
@@ -0,0 +1,10 @@
1
+ export { AbstractDialogHandler, IDialogService, IFileDialogService, getFileNamesMessage } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
2
+
3
+ var ConfirmResult;
4
+ ( (function(ConfirmResult) {
5
+ ConfirmResult[ConfirmResult["SAVE"] = 0] = "SAVE";
6
+ ConfirmResult[ConfirmResult["DONT_SAVE"] = 1] = "DONT_SAVE";
7
+ ConfirmResult[ConfirmResult["CANCEL"] = 2] = "CANCEL";
8
+ })(ConfirmResult || (ConfirmResult = {})));
9
+
10
+ export { ConfirmResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-configuration-service-override",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,13 +18,13 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@4.1.0",
22
- "@codingame/monaco-vscode-files-service-override": "4.1.0",
23
- "@codingame/monaco-vscode-quickaccess-service-override": "4.1.0",
24
- "@codingame/monaco-vscode-extensions-service-override": "4.1.0",
25
- "@codingame/monaco-vscode-environment-service-override": "4.1.0",
26
- "@codingame/monaco-vscode-layout-service-override": "4.1.0",
27
- "@codingame/monaco-vscode-host-service-override": "4.1.0",
28
- "@codingame/monaco-vscode-base-service-override": "4.1.0"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@4.1.2",
22
+ "@codingame/monaco-vscode-files-service-override": "4.1.2",
23
+ "@codingame/monaco-vscode-quickaccess-service-override": "4.1.2",
24
+ "@codingame/monaco-vscode-extensions-service-override": "4.1.2",
25
+ "@codingame/monaco-vscode-environment-service-override": "4.1.2",
26
+ "@codingame/monaco-vscode-layout-service-override": "4.1.2",
27
+ "@codingame/monaco-vscode-host-service-override": "4.1.2",
28
+ "@codingame/monaco-vscode-base-service-override": "4.1.2"
29
29
  }
30
30
  }
@@ -0,0 +1,118 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { Position } from 'vscode/vscode/vs/editor/common/core/position';
5
+ import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
6
+ import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
7
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
8
+
9
+ let TextResourceConfigurationService = class TextResourceConfigurationService extends Disposable {
10
+ constructor(configurationService, modelService, languageService) {
11
+ super();
12
+ this.configurationService = configurationService;
13
+ this.modelService = modelService;
14
+ this.languageService = languageService;
15
+ this._onDidChangeConfiguration = this._register(( new Emitter()));
16
+ this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
17
+ this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))));
18
+ }
19
+ getValue(resource, arg2, arg3) {
20
+ if (typeof arg3 === 'string') {
21
+ return this._getValue(resource, Position.isIPosition(arg2) ? arg2 : null, arg3);
22
+ }
23
+ return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined);
24
+ }
25
+ updateValue(resource, key, value, configurationTarget) {
26
+ const language = this.getLanguage(resource, null);
27
+ const configurationValue = this.configurationService.inspect(key, { resource, overrideIdentifier: language });
28
+ if (configurationTarget === undefined) {
29
+ configurationTarget = this.deriveConfigurationTarget(configurationValue, language);
30
+ }
31
+ switch (configurationTarget) {
32
+ case 8 :
33
+ return this._updateValue(key, value, configurationTarget, configurationValue.memory?.override, resource, language);
34
+ case 6 :
35
+ return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolder?.override, resource, language);
36
+ case 5 :
37
+ return this._updateValue(key, value, configurationTarget, configurationValue.workspace?.override, resource, language);
38
+ case 4 :
39
+ return this._updateValue(key, value, configurationTarget, configurationValue.userRemote?.override, resource, language);
40
+ default:
41
+ return this._updateValue(key, value, configurationTarget, configurationValue.userLocal?.override, resource, language);
42
+ }
43
+ }
44
+ _updateValue(key, value, configurationTarget, overriddenValue, resource, language) {
45
+ if (language && overriddenValue !== undefined) {
46
+ return this.configurationService.updateValue(key, value, { resource, overrideIdentifier: language }, configurationTarget);
47
+ }
48
+ else {
49
+ return this.configurationService.updateValue(key, value, { resource }, configurationTarget);
50
+ }
51
+ }
52
+ deriveConfigurationTarget(configurationValue, language) {
53
+ if (language) {
54
+ if (configurationValue.memory?.override !== undefined) {
55
+ return 8 ;
56
+ }
57
+ if (configurationValue.workspaceFolder?.override !== undefined) {
58
+ return 6 ;
59
+ }
60
+ if (configurationValue.workspace?.override !== undefined) {
61
+ return 5 ;
62
+ }
63
+ if (configurationValue.userRemote?.override !== undefined) {
64
+ return 4 ;
65
+ }
66
+ if (configurationValue.userLocal?.override !== undefined) {
67
+ return 3 ;
68
+ }
69
+ }
70
+ if (configurationValue.memory?.value !== undefined) {
71
+ return 8 ;
72
+ }
73
+ if (configurationValue.workspaceFolder?.value !== undefined) {
74
+ return 6 ;
75
+ }
76
+ if (configurationValue.workspace?.value !== undefined) {
77
+ return 5 ;
78
+ }
79
+ if (configurationValue.userRemote?.value !== undefined) {
80
+ return 4 ;
81
+ }
82
+ return 3 ;
83
+ }
84
+ _getValue(resource, position, section) {
85
+ const language = resource ? this.getLanguage(resource, position) : undefined;
86
+ if (typeof section === 'undefined') {
87
+ return this.configurationService.getValue({ resource, overrideIdentifier: language });
88
+ }
89
+ return this.configurationService.getValue(section, { resource, overrideIdentifier: language });
90
+ }
91
+ inspect(resource, position, section) {
92
+ const language = resource ? this.getLanguage(resource, position) : undefined;
93
+ return this.configurationService.inspect(section, { resource, overrideIdentifier: language });
94
+ }
95
+ getLanguage(resource, position) {
96
+ const model = this.modelService.getModel(resource);
97
+ if (model) {
98
+ return position ? model.getLanguageIdAtPosition(position.lineNumber, position.column) : model.getLanguageId();
99
+ }
100
+ return this.languageService.guessLanguageIdByFilepathOrFirstLine(resource);
101
+ }
102
+ toResourceConfigurationChangeEvent(configurationChangeEvent) {
103
+ return {
104
+ affectedKeys: configurationChangeEvent.affectedKeys,
105
+ affectsConfiguration: (resource, configuration) => {
106
+ const overrideIdentifier = resource ? this.getLanguage(resource, null) : undefined;
107
+ return configurationChangeEvent.affectsConfiguration(configuration, { resource, overrideIdentifier });
108
+ }
109
+ };
110
+ }
111
+ };
112
+ TextResourceConfigurationService = ( __decorate([
113
+ ( __param(0, IConfigurationService)),
114
+ ( __param(1, IModelService)),
115
+ ( __param(2, ILanguageService))
116
+ ], TextResourceConfigurationService));
117
+
118
+ export { TextResourceConfigurationService };