@theia/keymaps 1.45.0 → 1.46.0-next.72
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/README.md +61 -61
- package/lib/browser/index.d.ts +3 -3
- package/lib/browser/index.js +30 -30
- package/lib/browser/keybinding-schema-updater.d.ts +85 -85
- package/lib/browser/keybinding-schema-updater.js +116 -116
- package/lib/browser/keybindings-widget.d.ts +275 -275
- package/lib/browser/keybindings-widget.js +824 -824
- package/lib/browser/keymaps-frontend-contribution.d.ts +37 -37
- package/lib/browser/keymaps-frontend-contribution.js +294 -294
- package/lib/browser/keymaps-frontend-module.d.ts +5 -5
- package/lib/browser/keymaps-frontend-module.js +44 -44
- package/lib/browser/keymaps-monaco-contribution.d.ts +1 -1
- package/lib/browser/keymaps-monaco-contribution.js +27 -27
- package/lib/browser/keymaps-service.d.ts +61 -61
- package/lib/browser/keymaps-service.js +231 -231
- package/lib/package.spec.js +25 -25
- package/package.json +8 -8
- package/src/browser/index.ts +19 -19
- package/src/browser/keybinding-schema-updater.ts +95 -95
- package/src/browser/keybindings-widget.tsx +953 -953
- package/src/browser/keymaps-frontend-contribution.ts +296 -296
- package/src/browser/keymaps-frontend-module.ts +44 -44
- package/src/browser/keymaps-monaco-contribution.ts +26 -26
- package/src/browser/keymaps-service.ts +214 -214
- package/src/browser/style/index.css +182 -182
- package/src/package.spec.ts +28 -28
package/README.md
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - KEYMAPS EXTENSION</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/keymaps` allows the user to reconfigure default keybindings with custom keymaps.\
|
|
16
|
-
By modifying the appropriate `keymaps.json`, the user can modify existing keybindings, or add keybindings to commands that do not yet have a keybinding associated to them.
|
|
17
|
-
|
|
18
|
-
Example of a valid `keymaps.json` file
|
|
19
|
-
|
|
20
|
-
```json
|
|
21
|
-
[
|
|
22
|
-
{
|
|
23
|
-
"command": "quickCommand",
|
|
24
|
-
"keybinding": "ctrl+shift+f4"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
```
|
|
28
|
-
where `command` is a unique command id and keybinding is a valid `keybinding`. There's also an optional `context` property that can be specified (which is also a unique string for a context id).
|
|
29
|
-
|
|
30
|
-
## Supported Keys
|
|
31
|
-
|
|
32
|
-
For most keys you can directly use the name of the key i.e `a`, `3`, `/`, `-`.
|
|
33
|
-
|
|
34
|
-
To use `ctrl` on Linux/Windows and `cmd` on OSX, use `ctrlcmd`.
|
|
35
|
-
|
|
36
|
-
You can use `shift`, `ctrl`, `alt`, `meta`, `option` (`alt`), `command` (`meta`), `cmd` (`meta`) as modifiers. Note that if you defined a custom shortcut with `cmd`, `command` or `meta`, the same keymaps file won't work on a Windows/Linux machine as this key doesn't have an equivalent.
|
|
37
|
-
|
|
38
|
-
You can also use the following strings for special keys: `backspace`, `tab`, `enter`, `return`, `capslock`, `esc`, `escape`, `space`, `pageup`, `pagedown`, `end`, `home`, `left`, `up`, `right`, `down`, `ins`, `del` and `plus`.
|
|
39
|
-
|
|
40
|
-
If unsure you can always look at the framework's [supported keys](https://eclipse-theia.github.io/theia/docs/next/modules/core.Key-4.html)
|
|
41
|
-
|
|
42
|
-
## Key Sequences
|
|
43
|
-
|
|
44
|
-
Key sequences like: `ctrl+x ctrl+a` or `ctrl+a b c` are supported. With the following limitations:
|
|
45
|
-
- If the key sequence exceeds 1 key chord it won't show in the electron menu.
|
|
46
|
-
- If the key sequence exceeds 2 key chords it won't show in the command palette.
|
|
47
|
-
|
|
48
|
-
## Additional Information
|
|
49
|
-
|
|
50
|
-
- [API documentation for `@theia/keymaps`](https://eclipse-theia.github.io/theia/docs/next/modules/keymaps.html)
|
|
51
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
52
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
53
|
-
|
|
54
|
-
## License
|
|
55
|
-
|
|
56
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
57
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
58
|
-
|
|
59
|
-
## Trademark
|
|
60
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
61
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - KEYMAPS EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/keymaps` allows the user to reconfigure default keybindings with custom keymaps.\
|
|
16
|
+
By modifying the appropriate `keymaps.json`, the user can modify existing keybindings, or add keybindings to commands that do not yet have a keybinding associated to them.
|
|
17
|
+
|
|
18
|
+
Example of a valid `keymaps.json` file
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
[
|
|
22
|
+
{
|
|
23
|
+
"command": "quickCommand",
|
|
24
|
+
"keybinding": "ctrl+shift+f4"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
```
|
|
28
|
+
where `command` is a unique command id and keybinding is a valid `keybinding`. There's also an optional `context` property that can be specified (which is also a unique string for a context id).
|
|
29
|
+
|
|
30
|
+
## Supported Keys
|
|
31
|
+
|
|
32
|
+
For most keys you can directly use the name of the key i.e `a`, `3`, `/`, `-`.
|
|
33
|
+
|
|
34
|
+
To use `ctrl` on Linux/Windows and `cmd` on OSX, use `ctrlcmd`.
|
|
35
|
+
|
|
36
|
+
You can use `shift`, `ctrl`, `alt`, `meta`, `option` (`alt`), `command` (`meta`), `cmd` (`meta`) as modifiers. Note that if you defined a custom shortcut with `cmd`, `command` or `meta`, the same keymaps file won't work on a Windows/Linux machine as this key doesn't have an equivalent.
|
|
37
|
+
|
|
38
|
+
You can also use the following strings for special keys: `backspace`, `tab`, `enter`, `return`, `capslock`, `esc`, `escape`, `space`, `pageup`, `pagedown`, `end`, `home`, `left`, `up`, `right`, `down`, `ins`, `del` and `plus`.
|
|
39
|
+
|
|
40
|
+
If unsure you can always look at the framework's [supported keys](https://eclipse-theia.github.io/theia/docs/next/modules/core.Key-4.html)
|
|
41
|
+
|
|
42
|
+
## Key Sequences
|
|
43
|
+
|
|
44
|
+
Key sequences like: `ctrl+x ctrl+a` or `ctrl+a b c` are supported. With the following limitations:
|
|
45
|
+
- If the key sequence exceeds 1 key chord it won't show in the electron menu.
|
|
46
|
+
- If the key sequence exceeds 2 key chords it won't show in the command palette.
|
|
47
|
+
|
|
48
|
+
## Additional Information
|
|
49
|
+
|
|
50
|
+
- [API documentation for `@theia/keymaps`](https://eclipse-theia.github.io/theia/docs/next/modules/keymaps.html)
|
|
51
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
52
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
57
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
58
|
+
|
|
59
|
+
## Trademark
|
|
60
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
61
|
+
https://www.eclipse.org/theia
|
package/lib/browser/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './keymaps-frontend-module';
|
|
2
|
-
export * from './keymaps-service';
|
|
3
|
-
export * from './keymaps-frontend-contribution';
|
|
1
|
+
export * from './keymaps-frontend-module';
|
|
2
|
+
export * from './keymaps-service';
|
|
3
|
+
export * from './keymaps-frontend-contribution';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/browser/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
__exportStar(require("./keymaps-frontend-module"), exports);
|
|
29
|
-
__exportStar(require("./keymaps-service"), exports);
|
|
30
|
-
__exportStar(require("./keymaps-frontend-contribution"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
__exportStar(require("./keymaps-frontend-module"), exports);
|
|
29
|
+
__exportStar(require("./keymaps-service"), exports);
|
|
30
|
+
__exportStar(require("./keymaps-frontend-contribution"), exports);
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { CommandRegistry, InMemoryResources } from '@theia/core/lib/common';
|
|
2
|
-
import { JsonSchemaContribution, JsonSchemaRegisterContext } from '@theia/core/lib/browser/json-schema-store';
|
|
3
|
-
import URI from '@theia/core/lib/common/uri';
|
|
4
|
-
export declare class KeybindingSchemaUpdater implements JsonSchemaContribution {
|
|
5
|
-
protected readonly uri: URI;
|
|
6
|
-
protected readonly commandRegistry: CommandRegistry;
|
|
7
|
-
protected readonly inMemoryResources: InMemoryResources;
|
|
8
|
-
protected init(): void;
|
|
9
|
-
registerSchemas(store: JsonSchemaRegisterContext): void;
|
|
10
|
-
protected updateSchema(): void;
|
|
11
|
-
}
|
|
12
|
-
export declare const keybindingSchema: {
|
|
13
|
-
$id: string;
|
|
14
|
-
type: string;
|
|
15
|
-
title: string;
|
|
16
|
-
default: never[];
|
|
17
|
-
definitions: {
|
|
18
|
-
key: {
|
|
19
|
-
type: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
items: {
|
|
24
|
-
type: string;
|
|
25
|
-
defaultSnippets: {
|
|
26
|
-
body: {
|
|
27
|
-
key: string;
|
|
28
|
-
command: string;
|
|
29
|
-
when: string;
|
|
30
|
-
};
|
|
31
|
-
}[];
|
|
32
|
-
allOf: ({
|
|
33
|
-
required: string[];
|
|
34
|
-
properties: {
|
|
35
|
-
command: {
|
|
36
|
-
anyOf: ({
|
|
37
|
-
type: string;
|
|
38
|
-
enum?: undefined;
|
|
39
|
-
enumDescriptions?: undefined;
|
|
40
|
-
} | {
|
|
41
|
-
enum: string[];
|
|
42
|
-
enumDescriptions: string[];
|
|
43
|
-
type?: undefined;
|
|
44
|
-
})[];
|
|
45
|
-
description: string;
|
|
46
|
-
};
|
|
47
|
-
when: {
|
|
48
|
-
type: string;
|
|
49
|
-
description: string;
|
|
50
|
-
};
|
|
51
|
-
args: {
|
|
52
|
-
description: string;
|
|
53
|
-
};
|
|
54
|
-
context: {
|
|
55
|
-
type: string;
|
|
56
|
-
description: string;
|
|
57
|
-
deprecationMessage: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
anyOf?: undefined;
|
|
61
|
-
} | {
|
|
62
|
-
anyOf: ({
|
|
63
|
-
required: string[];
|
|
64
|
-
properties: {
|
|
65
|
-
key: {
|
|
66
|
-
$ref: string;
|
|
67
|
-
};
|
|
68
|
-
keybinding?: undefined;
|
|
69
|
-
};
|
|
70
|
-
} | {
|
|
71
|
-
required: string[];
|
|
72
|
-
properties: {
|
|
73
|
-
keybinding: {
|
|
74
|
-
$ref: string;
|
|
75
|
-
};
|
|
76
|
-
key?: undefined;
|
|
77
|
-
};
|
|
78
|
-
})[];
|
|
79
|
-
required?: undefined;
|
|
80
|
-
properties?: undefined;
|
|
81
|
-
})[];
|
|
82
|
-
};
|
|
83
|
-
allowComments: boolean;
|
|
84
|
-
allowTrailingCommas: boolean;
|
|
85
|
-
};
|
|
1
|
+
import { CommandRegistry, InMemoryResources } from '@theia/core/lib/common';
|
|
2
|
+
import { JsonSchemaContribution, JsonSchemaRegisterContext } from '@theia/core/lib/browser/json-schema-store';
|
|
3
|
+
import URI from '@theia/core/lib/common/uri';
|
|
4
|
+
export declare class KeybindingSchemaUpdater implements JsonSchemaContribution {
|
|
5
|
+
protected readonly uri: URI;
|
|
6
|
+
protected readonly commandRegistry: CommandRegistry;
|
|
7
|
+
protected readonly inMemoryResources: InMemoryResources;
|
|
8
|
+
protected init(): void;
|
|
9
|
+
registerSchemas(store: JsonSchemaRegisterContext): void;
|
|
10
|
+
protected updateSchema(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const keybindingSchema: {
|
|
13
|
+
$id: string;
|
|
14
|
+
type: string;
|
|
15
|
+
title: string;
|
|
16
|
+
default: never[];
|
|
17
|
+
definitions: {
|
|
18
|
+
key: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
items: {
|
|
24
|
+
type: string;
|
|
25
|
+
defaultSnippets: {
|
|
26
|
+
body: {
|
|
27
|
+
key: string;
|
|
28
|
+
command: string;
|
|
29
|
+
when: string;
|
|
30
|
+
};
|
|
31
|
+
}[];
|
|
32
|
+
allOf: ({
|
|
33
|
+
required: string[];
|
|
34
|
+
properties: {
|
|
35
|
+
command: {
|
|
36
|
+
anyOf: ({
|
|
37
|
+
type: string;
|
|
38
|
+
enum?: undefined;
|
|
39
|
+
enumDescriptions?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
enum: string[];
|
|
42
|
+
enumDescriptions: string[];
|
|
43
|
+
type?: undefined;
|
|
44
|
+
})[];
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
when: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
args: {
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
context: {
|
|
55
|
+
type: string;
|
|
56
|
+
description: string;
|
|
57
|
+
deprecationMessage: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
anyOf?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
anyOf: ({
|
|
63
|
+
required: string[];
|
|
64
|
+
properties: {
|
|
65
|
+
key: {
|
|
66
|
+
$ref: string;
|
|
67
|
+
};
|
|
68
|
+
keybinding?: undefined;
|
|
69
|
+
};
|
|
70
|
+
} | {
|
|
71
|
+
required: string[];
|
|
72
|
+
properties: {
|
|
73
|
+
keybinding: {
|
|
74
|
+
$ref: string;
|
|
75
|
+
};
|
|
76
|
+
key?: undefined;
|
|
77
|
+
};
|
|
78
|
+
})[];
|
|
79
|
+
required?: undefined;
|
|
80
|
+
properties?: undefined;
|
|
81
|
+
})[];
|
|
82
|
+
};
|
|
83
|
+
allowComments: boolean;
|
|
84
|
+
allowTrailingCommas: boolean;
|
|
85
|
+
};
|
|
86
86
|
//# sourceMappingURL=keybinding-schema-updater.d.ts.map
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2022 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.keybindingSchema = exports.KeybindingSchemaUpdater = void 0;
|
|
28
|
-
const common_1 = require("@theia/core/lib/common");
|
|
29
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
31
|
-
let KeybindingSchemaUpdater = class KeybindingSchemaUpdater {
|
|
32
|
-
constructor() {
|
|
33
|
-
this.uri = new uri_1.default(keybindingSchemaId);
|
|
34
|
-
}
|
|
35
|
-
init() {
|
|
36
|
-
this.inMemoryResources.add(new uri_1.default(keybindingSchemaId), '');
|
|
37
|
-
this.updateSchema();
|
|
38
|
-
this.commandRegistry.onCommandsChanged(() => this.updateSchema());
|
|
39
|
-
}
|
|
40
|
-
registerSchemas(store) {
|
|
41
|
-
store.registerSchema({
|
|
42
|
-
fileMatch: ['keybindings.json', 'keymaps.json'],
|
|
43
|
-
url: this.uri.toString(),
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
updateSchema() {
|
|
47
|
-
var _a;
|
|
48
|
-
const schema = (0, common_1.deepClone)(exports.keybindingSchema);
|
|
49
|
-
const enumValues = schema.items.allOf[0].properties.command.anyOf[1].enum;
|
|
50
|
-
const enumDescriptions = schema.items.allOf[0].properties.command.anyOf[1].enumDescriptions;
|
|
51
|
-
for (const command of this.commandRegistry.getAllCommands()) {
|
|
52
|
-
if (command.handlers.length > 0 && !command.id.startsWith('_')) {
|
|
53
|
-
enumValues.push(command.id);
|
|
54
|
-
enumDescriptions.push((_a = command.label) !== null && _a !== void 0 ? _a : '');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
this.inMemoryResources.update(this.uri, JSON.stringify(schema));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, inversify_1.inject)(common_1.CommandRegistry),
|
|
62
|
-
__metadata("design:type", common_1.CommandRegistry)
|
|
63
|
-
], KeybindingSchemaUpdater.prototype, "commandRegistry", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, inversify_1.inject)(common_1.InMemoryResources),
|
|
66
|
-
__metadata("design:type", common_1.InMemoryResources)
|
|
67
|
-
], KeybindingSchemaUpdater.prototype, "inMemoryResources", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, inversify_1.postConstruct)(),
|
|
70
|
-
__metadata("design:type", Function),
|
|
71
|
-
__metadata("design:paramtypes", []),
|
|
72
|
-
__metadata("design:returntype", void 0)
|
|
73
|
-
], KeybindingSchemaUpdater.prototype, "init", null);
|
|
74
|
-
KeybindingSchemaUpdater = __decorate([
|
|
75
|
-
(0, inversify_1.injectable)()
|
|
76
|
-
], KeybindingSchemaUpdater);
|
|
77
|
-
exports.KeybindingSchemaUpdater = KeybindingSchemaUpdater;
|
|
78
|
-
const keybindingSchemaId = 'vscode://schemas/keybindings';
|
|
79
|
-
exports.keybindingSchema = {
|
|
80
|
-
$id: keybindingSchemaId,
|
|
81
|
-
type: 'array',
|
|
82
|
-
title: 'Keybinding Configuration File',
|
|
83
|
-
default: [],
|
|
84
|
-
definitions: {
|
|
85
|
-
key: { type: 'string', description: common_1.nls.localizeByDefault('Key or key sequence (separated by space)') },
|
|
86
|
-
},
|
|
87
|
-
items: {
|
|
88
|
-
type: 'object',
|
|
89
|
-
defaultSnippets: [{ body: { key: '$1', command: '$2', when: '$3' } }],
|
|
90
|
-
allOf: [
|
|
91
|
-
{
|
|
92
|
-
required: ['command'],
|
|
93
|
-
properties: {
|
|
94
|
-
command: {
|
|
95
|
-
anyOf: [{ type: 'string' }, { enum: [], enumDescriptions: [] }], description: common_1.nls.localizeByDefault('Name of the command to execute')
|
|
96
|
-
},
|
|
97
|
-
when: { type: 'string', description: common_1.nls.localizeByDefault('Condition when the key is active.') },
|
|
98
|
-
args: { description: common_1.nls.localizeByDefault('Arguments to pass to the command to execute.') },
|
|
99
|
-
context: {
|
|
100
|
-
type: 'string',
|
|
101
|
-
description: common_1.nls.localizeByDefault('Condition when the key is active.'),
|
|
102
|
-
deprecationMessage: common_1.nls.localize('theia/keybinding-schema-updater/deprecation', 'Use `when` clause instead.')
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
anyOf: [
|
|
108
|
-
{ required: ['key'], properties: { key: { $ref: '#/definitions/key' }, } },
|
|
109
|
-
{ required: ['keybinding'], properties: { keybinding: { $ref: '#/definitions/key' } } }
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
]
|
|
113
|
-
},
|
|
114
|
-
allowComments: true,
|
|
115
|
-
allowTrailingCommas: true,
|
|
116
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2022 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.keybindingSchema = exports.KeybindingSchemaUpdater = void 0;
|
|
28
|
+
const common_1 = require("@theia/core/lib/common");
|
|
29
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
31
|
+
let KeybindingSchemaUpdater = class KeybindingSchemaUpdater {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.uri = new uri_1.default(keybindingSchemaId);
|
|
34
|
+
}
|
|
35
|
+
init() {
|
|
36
|
+
this.inMemoryResources.add(new uri_1.default(keybindingSchemaId), '');
|
|
37
|
+
this.updateSchema();
|
|
38
|
+
this.commandRegistry.onCommandsChanged(() => this.updateSchema());
|
|
39
|
+
}
|
|
40
|
+
registerSchemas(store) {
|
|
41
|
+
store.registerSchema({
|
|
42
|
+
fileMatch: ['keybindings.json', 'keymaps.json'],
|
|
43
|
+
url: this.uri.toString(),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
updateSchema() {
|
|
47
|
+
var _a;
|
|
48
|
+
const schema = (0, common_1.deepClone)(exports.keybindingSchema);
|
|
49
|
+
const enumValues = schema.items.allOf[0].properties.command.anyOf[1].enum;
|
|
50
|
+
const enumDescriptions = schema.items.allOf[0].properties.command.anyOf[1].enumDescriptions;
|
|
51
|
+
for (const command of this.commandRegistry.getAllCommands()) {
|
|
52
|
+
if (command.handlers.length > 0 && !command.id.startsWith('_')) {
|
|
53
|
+
enumValues.push(command.id);
|
|
54
|
+
enumDescriptions.push((_a = command.label) !== null && _a !== void 0 ? _a : '');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
this.inMemoryResources.update(this.uri, JSON.stringify(schema));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, inversify_1.inject)(common_1.CommandRegistry),
|
|
62
|
+
__metadata("design:type", common_1.CommandRegistry)
|
|
63
|
+
], KeybindingSchemaUpdater.prototype, "commandRegistry", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, inversify_1.inject)(common_1.InMemoryResources),
|
|
66
|
+
__metadata("design:type", common_1.InMemoryResources)
|
|
67
|
+
], KeybindingSchemaUpdater.prototype, "inMemoryResources", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, inversify_1.postConstruct)(),
|
|
70
|
+
__metadata("design:type", Function),
|
|
71
|
+
__metadata("design:paramtypes", []),
|
|
72
|
+
__metadata("design:returntype", void 0)
|
|
73
|
+
], KeybindingSchemaUpdater.prototype, "init", null);
|
|
74
|
+
KeybindingSchemaUpdater = __decorate([
|
|
75
|
+
(0, inversify_1.injectable)()
|
|
76
|
+
], KeybindingSchemaUpdater);
|
|
77
|
+
exports.KeybindingSchemaUpdater = KeybindingSchemaUpdater;
|
|
78
|
+
const keybindingSchemaId = 'vscode://schemas/keybindings';
|
|
79
|
+
exports.keybindingSchema = {
|
|
80
|
+
$id: keybindingSchemaId,
|
|
81
|
+
type: 'array',
|
|
82
|
+
title: 'Keybinding Configuration File',
|
|
83
|
+
default: [],
|
|
84
|
+
definitions: {
|
|
85
|
+
key: { type: 'string', description: common_1.nls.localizeByDefault('Key or key sequence (separated by space)') },
|
|
86
|
+
},
|
|
87
|
+
items: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
defaultSnippets: [{ body: { key: '$1', command: '$2', when: '$3' } }],
|
|
90
|
+
allOf: [
|
|
91
|
+
{
|
|
92
|
+
required: ['command'],
|
|
93
|
+
properties: {
|
|
94
|
+
command: {
|
|
95
|
+
anyOf: [{ type: 'string' }, { enum: [], enumDescriptions: [] }], description: common_1.nls.localizeByDefault('Name of the command to execute')
|
|
96
|
+
},
|
|
97
|
+
when: { type: 'string', description: common_1.nls.localizeByDefault('Condition when the key is active.') },
|
|
98
|
+
args: { description: common_1.nls.localizeByDefault('Arguments to pass to the command to execute.') },
|
|
99
|
+
context: {
|
|
100
|
+
type: 'string',
|
|
101
|
+
description: common_1.nls.localizeByDefault('Condition when the key is active.'),
|
|
102
|
+
deprecationMessage: common_1.nls.localize('theia/keybinding-schema-updater/deprecation', 'Use `when` clause instead.')
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
anyOf: [
|
|
108
|
+
{ required: ['key'], properties: { key: { $ref: '#/definitions/key' }, } },
|
|
109
|
+
{ required: ['keybinding'], properties: { keybinding: { $ref: '#/definitions/key' } } }
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
allowComments: true,
|
|
115
|
+
allowTrailingCommas: true,
|
|
116
|
+
};
|
|
117
117
|
//# sourceMappingURL=keybinding-schema-updater.js.map
|