@theia/keymaps 1.53.0-next.5 → 1.53.0-next.55

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 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/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@theia/keymaps",
3
- "version": "1.53.0-next.5+1e5fb536d",
3
+ "version": "1.53.0-next.55+d1a989a68c",
4
4
  "description": "Theia - Custom Keymaps Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.53.0-next.5+1e5fb536d",
7
- "@theia/monaco": "1.53.0-next.5+1e5fb536d",
6
+ "@theia/core": "1.53.0-next.55+d1a989a68c",
7
+ "@theia/monaco": "1.53.0-next.55+d1a989a68c",
8
8
  "@theia/monaco-editor-core": "1.83.101",
9
- "@theia/preferences": "1.53.0-next.5+1e5fb536d",
10
- "@theia/userstorage": "1.53.0-next.5+1e5fb536d",
9
+ "@theia/preferences": "1.53.0-next.55+d1a989a68c",
10
+ "@theia/userstorage": "1.53.0-next.55+d1a989a68c",
11
11
  "jsonc-parser": "^2.2.0",
12
12
  "tslib": "^2.6.2"
13
13
  },
14
14
  "devDependencies": {
15
- "@theia/ext-scripts": "1.52.0"
15
+ "@theia/ext-scripts": "1.53.0"
16
16
  },
17
17
  "publishConfig": {
18
18
  "access": "public"
@@ -49,5 +49,5 @@
49
49
  "nyc": {
50
50
  "extends": "../../configs/nyc.json"
51
51
  },
52
- "gitHead": "1e5fb536d65550ad8fa0fefcec731645b2afc74a"
52
+ "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
53
53
  }
@@ -1,19 +1,19 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- export * from './keymaps-frontend-module';
18
- export * from './keymaps-service';
19
- export * from './keymaps-frontend-contribution';
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ export * from './keymaps-frontend-module';
18
+ export * from './keymaps-service';
19
+ export * from './keymaps-frontend-contribution';
@@ -1,95 +1,95 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2022 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { nls, CommandRegistry, InMemoryResources, deepClone } from '@theia/core/lib/common';
18
- import { JsonSchemaContribution, JsonSchemaRegisterContext } from '@theia/core/lib/browser/json-schema-store';
19
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
20
- import URI from '@theia/core/lib/common/uri';
21
-
22
- @injectable()
23
- export class KeybindingSchemaUpdater implements JsonSchemaContribution {
24
- protected readonly uri = new URI(keybindingSchemaId);
25
- @inject(CommandRegistry) protected readonly commandRegistry: CommandRegistry;
26
- @inject(InMemoryResources) protected readonly inMemoryResources: InMemoryResources;
27
-
28
- @postConstruct()
29
- protected init(): void {
30
- this.inMemoryResources.add(new URI(keybindingSchemaId), '');
31
- this.updateSchema();
32
- this.commandRegistry.onCommandsChanged(() => this.updateSchema());
33
- }
34
-
35
- registerSchemas(store: JsonSchemaRegisterContext): void {
36
- store.registerSchema({
37
- fileMatch: ['keybindings.json', 'keymaps.json'],
38
- url: this.uri.toString(),
39
- });
40
- }
41
-
42
- protected updateSchema(): void {
43
- const schema = deepClone(keybindingSchema);
44
- const enumValues = schema.items.allOf[0].properties!.command.anyOf[1].enum!;
45
- const enumDescriptions = schema.items.allOf[0].properties!.command.anyOf[1].enumDescriptions!;
46
- for (const command of this.commandRegistry.getAllCommands()) {
47
- if (command.handlers.length > 0 && !command.id.startsWith('_')) {
48
- enumValues.push(command.id);
49
- enumDescriptions.push(command.label ?? '');
50
- }
51
- }
52
- this.inMemoryResources.update(this.uri, JSON.stringify(schema));
53
- }
54
- }
55
-
56
- const keybindingSchemaId = 'vscode://schemas/keybindings';
57
- export const keybindingSchema = {
58
- $id: keybindingSchemaId,
59
- type: 'array',
60
- title: 'Keybinding Configuration File',
61
- default: [],
62
- definitions: {
63
- key: { type: 'string', description: nls.localizeByDefault('Key or key sequence (separated by space)') },
64
- },
65
- items: {
66
- type: 'object',
67
- defaultSnippets: [{ body: { key: '$1', command: '$2', when: '$3' } }],
68
- allOf: [
69
- {
70
- required: ['command'],
71
- properties: {
72
- command: {
73
- anyOf: [{ type: 'string' }, { enum: <string[]>[], enumDescriptions: <string[]>[] }], description: nls.localizeByDefault('Name of the command to execute')
74
- },
75
- when: { type: 'string', description: nls.localizeByDefault('Condition when the key is active.') },
76
- args: { description: nls.localizeByDefault('Arguments to pass to the command to execute.') },
77
- context: {
78
- type: 'string',
79
- description: nls.localizeByDefault('Condition when the key is active.'),
80
- deprecationMessage: nls.localize('theia/keybinding-schema-updater/deprecation', 'Use `when` clause instead.')
81
- }
82
- }
83
- },
84
- {
85
- anyOf: [
86
- { required: ['key'], properties: { key: { $ref: '#/definitions/key' }, } },
87
- { required: ['keybinding'], properties: { keybinding: { $ref: '#/definitions/key' } } }
88
- ]
89
- }
90
- ]
91
- },
92
- allowComments: true,
93
- allowTrailingCommas: true,
94
- };
95
-
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { nls, CommandRegistry, InMemoryResources, deepClone } from '@theia/core/lib/common';
18
+ import { JsonSchemaContribution, JsonSchemaRegisterContext } from '@theia/core/lib/browser/json-schema-store';
19
+ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
20
+ import URI from '@theia/core/lib/common/uri';
21
+
22
+ @injectable()
23
+ export class KeybindingSchemaUpdater implements JsonSchemaContribution {
24
+ protected readonly uri = new URI(keybindingSchemaId);
25
+ @inject(CommandRegistry) protected readonly commandRegistry: CommandRegistry;
26
+ @inject(InMemoryResources) protected readonly inMemoryResources: InMemoryResources;
27
+
28
+ @postConstruct()
29
+ protected init(): void {
30
+ this.inMemoryResources.add(new URI(keybindingSchemaId), '');
31
+ this.updateSchema();
32
+ this.commandRegistry.onCommandsChanged(() => this.updateSchema());
33
+ }
34
+
35
+ registerSchemas(store: JsonSchemaRegisterContext): void {
36
+ store.registerSchema({
37
+ fileMatch: ['keybindings.json', 'keymaps.json'],
38
+ url: this.uri.toString(),
39
+ });
40
+ }
41
+
42
+ protected updateSchema(): void {
43
+ const schema = deepClone(keybindingSchema);
44
+ const enumValues = schema.items.allOf[0].properties!.command.anyOf[1].enum!;
45
+ const enumDescriptions = schema.items.allOf[0].properties!.command.anyOf[1].enumDescriptions!;
46
+ for (const command of this.commandRegistry.getAllCommands()) {
47
+ if (command.handlers.length > 0 && !command.id.startsWith('_')) {
48
+ enumValues.push(command.id);
49
+ enumDescriptions.push(command.label ?? '');
50
+ }
51
+ }
52
+ this.inMemoryResources.update(this.uri, JSON.stringify(schema));
53
+ }
54
+ }
55
+
56
+ const keybindingSchemaId = 'vscode://schemas/keybindings';
57
+ export const keybindingSchema = {
58
+ $id: keybindingSchemaId,
59
+ type: 'array',
60
+ title: 'Keybinding Configuration File',
61
+ default: [],
62
+ definitions: {
63
+ key: { type: 'string', description: nls.localizeByDefault('Key or key sequence (separated by space)') },
64
+ },
65
+ items: {
66
+ type: 'object',
67
+ defaultSnippets: [{ body: { key: '$1', command: '$2', when: '$3' } }],
68
+ allOf: [
69
+ {
70
+ required: ['command'],
71
+ properties: {
72
+ command: {
73
+ anyOf: [{ type: 'string' }, { enum: <string[]>[], enumDescriptions: <string[]>[] }], description: nls.localizeByDefault('Name of the command to execute')
74
+ },
75
+ when: { type: 'string', description: nls.localizeByDefault('Condition when the key is active.') },
76
+ args: { description: nls.localizeByDefault('Arguments to pass to the command to execute.') },
77
+ context: {
78
+ type: 'string',
79
+ description: nls.localizeByDefault('Condition when the key is active.'),
80
+ deprecationMessage: nls.localize('theia/keybinding-schema-updater/deprecation', 'Use `when` clause instead.')
81
+ }
82
+ }
83
+ },
84
+ {
85
+ anyOf: [
86
+ { required: ['key'], properties: { key: { $ref: '#/definitions/key' }, } },
87
+ { required: ['keybinding'], properties: { keybinding: { $ref: '#/definitions/key' } } }
88
+ ]
89
+ }
90
+ ]
91
+ },
92
+ allowComments: true,
93
+ allowTrailingCommas: true,
94
+ };
95
+