monaco-languageclient 5.0.0-next.0 → 5.0.0-next.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this npm module are documented in this file.
4
4
 
5
+ ## [5.0.0] - upcoming
6
+
7
+ - **BREAKING CHANGE**: Do not reexport code of imported libraries (e.g. vscode-languageclient) #[459](https://github.com/TypeFox/monaco-languageclient/pull/459)
8
+ - Content of `vscode-jsonrpc`,`vscode-languageclient` and `vscode-languageserver-protocol` is no longer re-exported
9
+ - Restructures example into less packages. It reduces maintenace efforts
10
+ - Web worker language server example is replaced with Langium Statemachine
11
+ - More services from `monaco-vscode-api` are used in this example (themes, text mate, keyboard)
12
+
5
13
  ## [4.0.3] - 2022-12-01
6
14
 
7
15
  - Fixed compile target configuration
@@ -0,0 +1,3 @@
1
+ export { fetchRemoteTheme, fetchAllThemesFromGitHub } from './themeRemoteHelper.js';
2
+ export { loadAllDefaultThemes } from './themeLocalHelper.js';
3
+ //# sourceMappingURL=themeHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/themeHelper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ export { fetchRemoteTheme, fetchAllThemesFromGitHub } from './themeRemoteHelper.js';
6
+ export { loadAllDefaultThemes } from './themeLocalHelper.js';
7
+ //# sourceMappingURL=themeHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeHelper.js","sourceRoot":"","sources":["../../src/helpers/themeHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const loadAllDefaultThemes: (targetDir: string) => Promise<void>;
2
+ //# sourceMappingURL=themeLocalHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeLocalHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/themeLocalHelper.ts"],"names":[],"mappings":"AAsEA,eAAO,MAAM,oBAAoB,cAAqB,MAAM,kBAgC3D,CAAC"}
@@ -0,0 +1,100 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ import { setDefaultThemes } from 'vscode/service-override/theme';
6
+ const createThemesDefintion = () => {
7
+ return [
8
+ {
9
+ id: 'Visual Studio Light',
10
+ label: 'Light (Visual Studio)',
11
+ uiTheme: 'vs-light',
12
+ path: './themes/light_vs.json',
13
+ extension: 'theme-defaults'
14
+ },
15
+ {
16
+ id: 'Default Light+',
17
+ label: 'Light+ (default light)',
18
+ uiTheme: 'vs-light',
19
+ path: './themes/light_plus.json',
20
+ extension: 'theme-defaults'
21
+ },
22
+ {
23
+ id: 'Light+ (Experimental)',
24
+ label: 'Light+ (Experimental)',
25
+ uiTheme: 'vs-light',
26
+ path: './themes/light_plus_experimental.json',
27
+ extension: 'theme-defaults'
28
+ },
29
+ {
30
+ id: 'Default High Contrast Light',
31
+ label: 'High Contrast Light',
32
+ uiTheme: 'hc-light',
33
+ path: './themes/hc_light.json'
34
+ },
35
+ {
36
+ id: 'Visual Studio Dark',
37
+ label: 'Dark (Visual Studio)',
38
+ uiTheme: 'vs-dark',
39
+ path: './themes/dark_vs.json',
40
+ extension: 'theme-defaults'
41
+ },
42
+ {
43
+ id: 'Default Dark+',
44
+ label: 'Dark+ (default dark)',
45
+ uiTheme: 'vs-dark',
46
+ path: './themes/dark_plus.json',
47
+ extension: 'theme-defaults'
48
+ },
49
+ {
50
+ id: 'Dark+ (Experimental)',
51
+ label: 'Dark+ (Experimental)',
52
+ uiTheme: 'vs-dark',
53
+ path: './themes/dark_plus_experimental.json',
54
+ extension: 'theme-defaults'
55
+ },
56
+ {
57
+ id: 'Default High Contrast Dark',
58
+ label: 'High Contrast Dark',
59
+ uiTheme: 'hc-black',
60
+ path: './themes/hc_black.json'
61
+ }
62
+ ];
63
+ };
64
+ const fetchLocalTheme = async (url) => {
65
+ const resp = await fetch(url);
66
+ return resp.text();
67
+ };
68
+ export const loadAllDefaultThemes = async (targetDir) => {
69
+ const themeLightVsUrl = new URL(targetDir + '/light_vs.json', window.location.href).href;
70
+ const themeLightPlusUrl = new URL(targetDir + '/light_plus.json', window.location.href).href;
71
+ const themeLightPlusExpUrl = new URL(targetDir + '/light_plus_experimental.json', window.location.href).href;
72
+ const themeLightHcUrl = new URL(targetDir + '/hc_light.json', window.location.href).href;
73
+ const themeDarkVsUrl = new URL(targetDir + '/dark_vs.json', window.location.href).href;
74
+ const themeDarkPlusUrl = new URL(targetDir + '/dark_plus.json', window.location.href).href;
75
+ const themeDarkPlusExpUrl = new URL(targetDir + '/dark_plus_experimental.json', window.location.href).href;
76
+ const themeDarkHcUrl = new URL(targetDir + '/hc_black.json', window.location.href).href;
77
+ setDefaultThemes(createThemesDefintion(), (theme) => {
78
+ switch (theme.path) {
79
+ case './themes/light_vs.json':
80
+ return fetchLocalTheme(themeLightVsUrl);
81
+ case './themes/light_plus.json':
82
+ return fetchLocalTheme(themeLightPlusUrl);
83
+ case './themes/light_plus_experimental.json':
84
+ return fetchLocalTheme(themeLightPlusExpUrl);
85
+ case './themes/hc_light.json':
86
+ return fetchLocalTheme(themeLightHcUrl);
87
+ case './themes/dark_vs.json':
88
+ return fetchLocalTheme(themeDarkVsUrl);
89
+ case './themes/dark_plus.json':
90
+ return fetchLocalTheme(themeDarkPlusUrl);
91
+ case './themes/dark_plus_experimental.json':
92
+ return fetchLocalTheme(themeDarkPlusExpUrl);
93
+ case './themes/hc_dark.json':
94
+ return fetchLocalTheme(themeDarkHcUrl);
95
+ default:
96
+ return Promise.reject(new Error(`Theme ${theme.path} not found`));
97
+ }
98
+ });
99
+ };
100
+ //# sourceMappingURL=themeLocalHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeLocalHelper.js","sourceRoot":"","sources":["../../src/helpers/themeLocalHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAwB,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEvF,MAAM,qBAAqB,GAAG,GAAG,EAAE;IAC/B,OAAO;QACH;YACI,EAAE,EAAE,qBAAqB;YACzB,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,wBAAwB;YAC9B,SAAS,EAAE,gBAAgB;SAC9B;QACD;YACI,EAAE,EAAE,gBAAgB;YACpB,KAAK,EAAE,wBAAwB;YAC/B,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,0BAA0B;YAChC,SAAS,EAAE,gBAAgB;SAC9B;QACD;YACI,EAAE,EAAE,uBAAuB;YAC3B,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,uCAAuC;YAC7C,SAAS,EAAE,gBAAgB;SAC9B;QACD;YACI,EAAE,EAAE,6BAA6B;YACjC,KAAK,EAAE,qBAAqB;YAC5B,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,wBAAwB;SACjC;QACD;YACI,EAAE,EAAE,oBAAoB;YACxB,KAAK,EAAE,sBAAsB;YAC7B,OAAO,EAAE,SAAS;YAClB,IAAI,EA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AC;SACzE;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const fetchRemoteTheme: (url: string, targetFile: string) => Promise<void>;
2
+ export declare const fetchAllThemesFromGitHub: (targetDir: string) => Promise<void>;
3
+ //# sourceMappingURL=themeRemoteHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeRemoteHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/themeRemoteHelper.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,QAAe,MAAM,cAAc,MAAM,kBAKrE,CAAC;AAGF,eAAO,MAAM,wBAAwB,cAAqB,MAAM,kBAY/D,CAAC"}
@@ -0,0 +1,25 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ import { writeFileSync } from 'fs';
6
+ export const fetchRemoteTheme = async (url, targetFile) => {
7
+ const res = await fetch(url);
8
+ res.text().then(x => {
9
+ writeFileSync(targetFile, x);
10
+ });
11
+ };
12
+ // re-fectch required themes
13
+ export const fetchAllThemesFromGitHub = async (targetDir) => {
14
+ // light
15
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_vs.json', targetDir + '/light_vs.json');
16
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_plus.json', targetDir + '/light_plus.json');
17
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_plus_experimental.json', targetDir + '/light_plus_experimental.json');
18
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/hc_light.json', targetDir + '/hc_light.json');
19
+ // dark
20
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_vs.json', targetDir + '/dark_vs.json');
21
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_plus.json', targetDir + '/dark_plus.json');
22
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_plus_experimental.json', targetDir + '/dark_plus_experimental.json');
23
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/hc_black.json', targetDir + '/hc_black.json');
24
+ };
25
+ //# sourceMappingURL=themeRemoteHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeRemoteHelper.js","sourceRoot":"","sources":["../../src/helpers/themeRemoteHelper.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,GAAW,EAAE,UAAkB,EAAE,EAAE;IACtE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QAChB,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,4BAA4B;AAC5B,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,SAAiB,EAAE,EAAE;IAChE,QAAQ;IACR,gBAAgB,CAAC,wGAAwG,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAC;IACzJ,gBAAgB,CAAC,0GAA0G,EAAE,SAAS,GAAG,kBAAkB,CAAC,CAAC;IAC7J,gBAAgB,CAAC,uHAAuH,EAAE,SAAS,GAAG,+BAA+B,CAAC,CAAC;IACvL,gBAAgB,CAAC,wGAAwG,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAC;IAEzJ,OAAO;IACP,gBAAgB,CAAC,uGAAuG,EAAE,SAAS,GAAG,eAAe,CAAC,CAAC;IACvJ,gBAAgB,CAAC,yGAAyG,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC;IAC3J,gBAAgB,CAAC,sHAAsH,EAAE,SAAS,GAAG,8BAA8B,CAAC,CAAC;IACrL,gBAAgB,CAAC,wGAAwG,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAC;AAC7J,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monaco-languageclient",
3
- "version": "5.0.0-next.0",
3
+ "version": "5.0.0-next.2",
4
4
  "description": "Monaco Language client implementation",
5
5
  "author": {
6
6
  "name": "TypeFox GmbH ",
@@ -23,12 +23,26 @@
23
23
  ".": {
24
24
  "types": "./lib/index.d.ts",
25
25
  "default": "./lib/index.js"
26
+ },
27
+ "./themeRemoteHelper": {
28
+ "types": "./lib/helpers/themeRemoteHelper.d.ts",
29
+ "default": "./lib/helpers/themeRemoteHelper.js"
30
+ },
31
+ "./themeLocalHelper": {
32
+ "types": "./lib/helpers/themeLocalHelper.d.ts",
33
+ "default": "./lib/helpers/themeLocalHelper.js"
26
34
  }
27
35
  },
28
36
  "typesVersions": {
29
37
  "*": {
30
38
  ".": [
31
- "lib/index"
39
+ "lib/index.d.ts"
40
+ ],
41
+ "themeRemoteHelper": [
42
+ "./lib/helpers/themeRemoteHelper.d.ts"
43
+ ],
44
+ "themeLocalHelper": [
45
+ "./lib/helpers/themeLocalHelper.d.ts"
32
46
  ]
33
47
  }
34
48
  },
@@ -37,8 +51,8 @@
37
51
  "npm": ">=9.0.0"
38
52
  },
39
53
  "volta": {
40
- "node": "18.14.0",
41
- "npm": "9.4.1"
54
+ "node": "18.14.2",
55
+ "npm": "9.5.1"
42
56
  },
43
57
  "files": [
44
58
  "lib",
@@ -0,0 +1,6 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ export { fetchRemoteTheme, fetchAllThemesFromGitHub } from './themeRemoteHelper.js';
6
+ export { loadAllDefaultThemes } from './themeLocalHelper.js';
@@ -0,0 +1,103 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ import { IThemeExtensionPoint, setDefaultThemes } from 'vscode/service-override/theme';
6
+
7
+ const createThemesDefintion = () => {
8
+ return [
9
+ {
10
+ id: 'Visual Studio Light',
11
+ label: 'Light (Visual Studio)',
12
+ uiTheme: 'vs-light',
13
+ path: './themes/light_vs.json',
14
+ extension: 'theme-defaults'
15
+ },
16
+ {
17
+ id: 'Default Light+',
18
+ label: 'Light+ (default light)',
19
+ uiTheme: 'vs-light',
20
+ path: './themes/light_plus.json',
21
+ extension: 'theme-defaults'
22
+ },
23
+ {
24
+ id: 'Light+ (Experimental)',
25
+ label: 'Light+ (Experimental)',
26
+ uiTheme: 'vs-light',
27
+ path: './themes/light_plus_experimental.json',
28
+ extension: 'theme-defaults'
29
+ },
30
+ {
31
+ id: 'Default High Contrast Light',
32
+ label: 'High Contrast Light',
33
+ uiTheme: 'hc-light',
34
+ path: './themes/hc_light.json'
35
+ },
36
+ {
37
+ id: 'Visual Studio Dark',
38
+ label: 'Dark (Visual Studio)',
39
+ uiTheme: 'vs-dark',
40
+ path: './themes/dark_vs.json',
41
+ extension: 'theme-defaults'
42
+ },
43
+ {
44
+ id: 'Default Dark+',
45
+ label: 'Dark+ (default dark)',
46
+ uiTheme: 'vs-dark',
47
+ path: './themes/dark_plus.json',
48
+ extension: 'theme-defaults'
49
+ },
50
+ {
51
+ id: 'Dark+ (Experimental)',
52
+ label: 'Dark+ (Experimental)',
53
+ uiTheme: 'vs-dark',
54
+ path: './themes/dark_plus_experimental.json',
55
+ extension: 'theme-defaults'
56
+ },
57
+ {
58
+ id: 'Default High Contrast Dark',
59
+ label: 'High Contrast Dark',
60
+ uiTheme: 'hc-black',
61
+ path: './themes/hc_black.json'
62
+ }
63
+ ] as IThemeExtensionPoint[];
64
+ };
65
+
66
+ const fetchLocalTheme = async (url: string) => {
67
+ const resp = await fetch(url);
68
+ return resp.text();
69
+ };
70
+
71
+ export const loadAllDefaultThemes = async (targetDir: string) => {
72
+ const themeLightVsUrl = new URL(targetDir + '/light_vs.json', window.location.href).href;
73
+ const themeLightPlusUrl = new URL(targetDir + '/light_plus.json', window.location.href).href;
74
+ const themeLightPlusExpUrl = new URL(targetDir + '/light_plus_experimental.json', window.location.href).href;
75
+ const themeLightHcUrl = new URL(targetDir + '/hc_light.json', window.location.href).href;
76
+ const themeDarkVsUrl = new URL(targetDir + '/dark_vs.json', window.location.href).href;
77
+ const themeDarkPlusUrl = new URL(targetDir + '/dark_plus.json', window.location.href).href;
78
+ const themeDarkPlusExpUrl = new URL(targetDir + '/dark_plus_experimental.json', window.location.href).href;
79
+ const themeDarkHcUrl = new URL(targetDir + '/hc_black.json', window.location.href).href;
80
+
81
+ setDefaultThemes(createThemesDefintion(), (theme) => {
82
+ switch (theme.path) {
83
+ case './themes/light_vs.json':
84
+ return fetchLocalTheme(themeLightVsUrl);
85
+ case './themes/light_plus.json':
86
+ return fetchLocalTheme(themeLightPlusUrl);
87
+ case './themes/light_plus_experimental.json':
88
+ return fetchLocalTheme(themeLightPlusExpUrl);
89
+ case './themes/hc_light.json':
90
+ return fetchLocalTheme(themeLightHcUrl);
91
+ case './themes/dark_vs.json':
92
+ return fetchLocalTheme(themeDarkVsUrl);
93
+ case './themes/dark_plus.json':
94
+ return fetchLocalTheme(themeDarkPlusUrl);
95
+ case './themes/dark_plus_experimental.json':
96
+ return fetchLocalTheme(themeDarkPlusExpUrl);
97
+ case './themes/hc_dark.json':
98
+ return fetchLocalTheme(themeDarkHcUrl);
99
+ default:
100
+ return Promise.reject(new Error(`Theme ${theme.path} not found`));
101
+ }
102
+ });
103
+ };
@@ -0,0 +1,27 @@
1
+ /* --------------------------------------------------------------------------------------------
2
+ * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ * ------------------------------------------------------------------------------------------ */
5
+ import { writeFileSync } from 'fs';
6
+
7
+ export const fetchRemoteTheme = async (url: string, targetFile: string) => {
8
+ const res = await fetch(url);
9
+ res.text().then(x => {
10
+ writeFileSync(targetFile, x);
11
+ });
12
+ };
13
+
14
+ // re-fectch required themes
15
+ export const fetchAllThemesFromGitHub = async (targetDir: string) => {
16
+ // light
17
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_vs.json', targetDir + '/light_vs.json');
18
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_plus.json', targetDir + '/light_plus.json');
19
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/light_plus_experimental.json', targetDir + '/light_plus_experimental.json');
20
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/hc_light.json', targetDir + '/hc_light.json');
21
+
22
+ // dark
23
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_vs.json', targetDir + '/dark_vs.json');
24
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_plus.json', targetDir + '/dark_plus.json');
25
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/dark_plus_experimental.json', targetDir + '/dark_plus_experimental.json');
26
+ fetchRemoteTheme('https://raw.githubusercontent.com/microsoft/vscode/main/extensions/theme-defaults/themes/hc_black.json', targetDir + '/hc_black.json');
27
+ };
@@ -1,7 +0,0 @@
1
- import { Disposable } from 'vscode-jsonrpc';
2
- export declare class DisposableCollection implements Disposable {
3
- protected readonly disposables: Disposable[];
4
- dispose(): void;
5
- push(disposable: Disposable): Disposable;
6
- }
7
- //# sourceMappingURL=disposable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,qBAAa,oBAAqB,YAAW,UAAU;IACnD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAM;IAElD,OAAO,IAAI,IAAI;IAMf,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;CAY3C"}
package/lib/disposable.js DELETED
@@ -1,25 +0,0 @@
1
- /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- * ------------------------------------------------------------------------------------------ */
5
- export class DisposableCollection {
6
- disposables = [];
7
- dispose() {
8
- while (this.disposables.length !== 0) {
9
- this.disposables.pop().dispose();
10
- }
11
- }
12
- push(disposable) {
13
- const disposables = this.disposables;
14
- disposables.push(disposable);
15
- return {
16
- dispose() {
17
- const index = disposables.indexOf(disposable);
18
- if (index !== -1) {
19
- disposables.splice(index, 1);
20
- }
21
- }
22
- };
23
- }
24
- }
25
- //# sourceMappingURL=disposable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,OAAO,oBAAoB;IACV,WAAW,GAAiB,EAAE,CAAC;IAElD,OAAO;QACH,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAG,CAAC,OAAO,EAAE,CAAC;SACrC;IACL,CAAC;IAED,IAAI,CAAC,UAAsB;QACvB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7B,OAAO;YACH,OAAO;gBACH,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBAC9C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;oBACd,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;iBAChC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CACJ"}
package/src/disposable.ts DELETED
@@ -1,29 +0,0 @@
1
- /* --------------------------------------------------------------------------------------------
2
- * Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- * ------------------------------------------------------------------------------------------ */
5
-
6
- import { Disposable } from 'vscode-jsonrpc';
7
-
8
- export class DisposableCollection implements Disposable {
9
- protected readonly disposables: Disposable[] = [];
10
-
11
- dispose(): void {
12
- while (this.disposables.length !== 0) {
13
- this.disposables.pop()!.dispose();
14
- }
15
- }
16
-
17
- push(disposable: Disposable): Disposable {
18
- const disposables = this.disposables;
19
- disposables.push(disposable);
20
- return {
21
- dispose(): void {
22
- const index = disposables.indexOf(disposable);
23
- if (index !== -1) {
24
- disposables.splice(index, 1);
25
- }
26
- }
27
- };
28
- }
29
- }