Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompts/node/test/fixtures/keybindingParser.ts
13406 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
export class KeybindingParser {
7
8
public static _readModifiers(input: string) {
9
input = input.toLowerCase().trim();
10
11
let ctrl = false;
12
let shift = false;
13
let alt = false;
14
let meta = false;
15
16
17
18
let key: string;
19
20
const firstSpaceIdx = input.indexOf(' ');
21
if (firstSpaceIdx > 0) {
22
key = input.substring(0, firstSpaceIdx);
23
input = input.substring(firstSpaceIdx);
24
} else {
25
key = input;
26
input = '';
27
}
28
29
return {
30
remains: input,
31
ctrl,
32
shift,
33
alt,
34
meta,
35
key
36
};
37
}
38
}
39
40