Skip to content

Commit 718a68d

Browse files
committed
1 parent 62ed4a6 commit 718a68d

File tree

4 files changed

+58
-32
lines changed

4 files changed

+58
-32
lines changed

package.json

+28-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vscode-hacker-typer",
3-
"displayName": "VSCode Test Hack",
4-
"description": "VSCode Test Hack",
3+
"displayName": "VSCode Hacker Typer 2",
4+
"description": "In progress",
55
"version": "0.1.1",
66
"license": "MIT",
77
"engines": {
@@ -16,75 +16,84 @@
1616
"Other"
1717
],
1818
"activationEvents": [
19-
"onCommand:tiagodanin.vscode-hacker-typer.recordMacro",
20-
"onCommand:tiagodanin.vscode-hacker-typer.playMacro",
21-
"onCommand:tiagodanin.vscode-hacker-typer.deleteMacro"
19+
"onCommand:com.tiagodanin.vscode-hacker-typer.recordMacro",
20+
"onCommand:com.tiagodanin.vscode-hacker-typer.playMacro",
21+
"onCommand:com.tiagodanin.vscode-hacker-typer.deleteMacro"
2222
],
2323
"main": "./out/extension",
2424
"contributes": {
2525
"keybindings": [
2626
{
27-
"command": "tiagodanin.vscode-hacker-typer.backspace",
27+
"command": "com.tiagodanin.vscode-hacker-typer.backspace",
2828
"when": "editorTextFocus",
2929
"key": "cmd+shift+backspace"
3030
},
3131
{
32-
"command": "tiagodanin.vscode-hacker-typer.recordMacro",
32+
"command": "com.tiagodanin.vscode-hacker-typer.recordMacro",
3333
"when": "editorTextFocus",
3434
"key": "cmd+shift+t r"
3535
},
3636
{
37-
"command": "tiagodanin.vscode-hacker-typer.playMacro",
37+
"command": "com.tiagodanin.vscode-hacker-typer.playMacro",
3838
"key": "cmd+shift+t p"
3939
},
4040
{
41-
"command": "tiagodanin.vscode-hacker-typer.saveMacro",
41+
"command": "com.tiagodanin.vscode-hacker-typer.saveMacro",
4242
"key": "cmd+shift+t s"
4343
},
4444
{
45-
"command": "tiagodanin.vscode-hacker-typer.insertStop",
45+
"command": "com.tiagodanin.vscode-hacker-typer.insertStop",
4646
"key": "cmd+shift+t i"
4747
},
4848
{
49-
"command": "tiagodanin.vscode-hacker-typer.insertNamedStop",
49+
"command": "com.tiagodanin.vscode-hacker-typer.insertNamedStop",
5050
"key": "cmd+shift+t n"
51+
},
52+
{
53+
"command": "com.tiagodanin.vscode-hacker-typer.exitMacro",
54+
"key": "cmd+shift+t e"
5155
}
5256
],
5357
"commands": [
5458
{
55-
"command": "tiagodanin.vscode-hacker-typer.recordMacro",
59+
"command": "com.tiagodanin.vscode-hacker-typer.recordMacro",
5660
"title": "Record Macro",
5761
"category": "HackerTyper"
5862
},
5963
{
60-
"command": "tiagodanin.vscode-hacker-typer.playMacro",
64+
"command": "com.tiagodanin.vscode-hacker-typer.playMacro",
6165
"title": "Play Macro",
6266
"category": "HackerTyper"
6367
},
6468
{
65-
"command": "tiagodanin.vscode-hacker-typer.saveMacro",
69+
"command": "com.tiagodanin.vscode-hacker-typer.saveMacro",
6670
"title": "Save Macro",
6771
"category": "HackerTyper"
6872
},
6973
{
70-
"command": "tiagodanin.vscode-hacker-typer.removeMacro",
74+
"command": "com.tiagodanin.vscode-hacker-typer.removeMacro",
7175
"title": "Remove Macro",
7276
"category": "HackerTyper"
7377
},
7478
{
75-
"command": "tiagodanin.vscode-hacker-typer.insertStop",
79+
"command": "com.tiagodanin.vscode-hacker-typer.insertStop",
7680
"title": "Insert Soft Stop Point",
7781
"category": "HackerTyper"
7882
},
7983
{
80-
"command": "tiagodanin.vscode-hacker-typer.insertNamedStop",
84+
"command": "com.tiagodanin.vscode-hacker-typer.insertNamedStop",
8185
"title": "Insert Named Stop Point",
8286
"category": "HackerTyper"
8387
},
8488
{
85-
"command": "tiagodanin.vscode-hacker-typer.backspace",
89+
"command": "com.tiagodanin.vscode-hacker-typer.backspace",
8690
"title": "Erase Previous Frame",
8791
"category": "HackerTyper"
92+
},
93+
{
94+
"command": "com.tiagodanin.vscode-hacker-typer.exitMacro",
95+
"title": "Exit Macro",
96+
"category": "HackerTyper"
8897
}
8998
]
9099
},
@@ -93,7 +102,7 @@
93102
"compile": "tsc -p ./",
94103
"watch": "tsc -watch -p ./",
95104
"postinstall": "node ./node_modules/vscode/bin/install",
96-
"test": "npm run compile && node ./node_modules/vscode/bin/test"
105+
"test": "yarn run compile && node ./node_modules/vscode/bin/test"
97106
},
98107
"devDependencies": {
99108
"@types/mocha": "^2.2.42",

src/Recorder.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ export default class Recorder {
3737
);
3838

3939
const insertNamedStop = vscode.commands.registerCommand(
40-
"tiagodanin.vscode-hacker-typer.insertNamedStop",
40+
"com.tiagodanin.vscode-hacker-typer.insertNamedStop",
4141
this.insertNamedStop,
4242
this
4343
);
4444

4545
const insertStop = vscode.commands.registerCommand(
46-
"tiagodanin.vscode-hacker-typer.insertStop",
46+
"com.tiagodanin.vscode-hacker-typer.insertStop",
4747
() => {
4848
this.insertStop(null);
4949
}
5050
);
5151

5252
const save = vscode.commands.registerCommand(
53-
"tiagodanin.vscode-hacker-typer.saveMacro",
53+
"com.tiagodanin.vscode-hacker-typer.saveMacro",
5454
() => {
5555
this.saveRecording(save);
5656
}
@@ -120,6 +120,7 @@ export default class Recorder {
120120
vscode.window.showInformationMessage(
121121
`Saved ${macro.buffers.length} buffers under "${macro.name}".`
122122
);
123+
123124
this.dispose();
124125
command.dispose();
125126
});

src/extension.ts

+18-10
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,22 @@ import * as replay from "./replay";
77
import { onSelectMacro } from "./replay";
88

99
export function activate(context: vscode.ExtensionContext) {
10-
console.log(
11-
'Congratulations, your extension "vscode-hacker-typer" is now active!'
12-
);
13-
1410
const onCommandRecord = vscode.commands.registerCommand(
15-
"tiagodanin.vscode-hacker-typer.recordMacro",
11+
"com.tiagodanin.vscode-hacker-typer.recordMacro",
1612
Recorder.register(context)
1713
);
14+
context.subscriptions.push(onCommandRecord);
1815

1916
const onCommandPlay = vscode.commands.registerCommand(
20-
"tiagodanin.vscode-hacker-typer.playMacro",
17+
"com.tiagodanin.vscode-hacker-typer.playMacro",
2118
() => {
2219
replay.start(context);
2320
}
2421
);
22+
context.subscriptions.push(onCommandPlay);
2523

2624
const onCommandRemove = vscode.commands.registerCommand(
27-
"tiagodanin.vscode-hacker-typer.removeMacro",
25+
"com.tiagodanin.vscode-hacker-typer.removeMacro",
2826
() => {
2927
const storage = Storage.getInstance(context);
3028
const items = storage.list();
@@ -38,13 +36,24 @@ export function activate(context: vscode.ExtensionContext) {
3836
});
3937
}
4038
);
39+
context.subscriptions.push(onCommandRemove);
4140

4241
const onCommandType = vscode.commands.registerCommand("type", replay.onType);
42+
context.subscriptions.push(onCommandType);
4343

4444
const onCommandBackspace = vscode.commands.registerCommand(
45-
"tiagodanin.vscode-hacker-typer.backspace",
45+
"com.tiagodanin.vscode-hacker-typer.backspace",
4646
replay.onBackspace
4747
);
48+
context.subscriptions.push(onCommandBackspace);
49+
50+
const onCommandExitMacro = vscode.commands.registerCommand(
51+
"jevakallio.vscode-hacker-typer.exitMacro",
52+
() => {
53+
replay.stopMacro();
54+
}
55+
)
56+
context.subscriptions.push(onCommandExitMacro);
4857

4958
const onOpenFile = vscode.workspace.onDidOpenTextDocument((file) => {
5059
console.log('file', file)
@@ -58,8 +67,7 @@ export function activate(context: vscode.ExtensionContext) {
5867
onSelectMacro(macro)
5968
}
6069
})
61-
62-
context.subscriptions.push(onCommandRecord, onCommandPlay, onCommandType, onCommandBackspace, onCommandRemove, onOpenFile);
70+
context.subscriptions.push(onOpenFile);
6371
}
6472

6573
export function deactivate() {}

src/replay.ts

+8
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ export function onBackspace() {
115115
vscode.commands.executeCommand("deleteLeft");
116116
}
117117

118+
export function stopMacro() {
119+
isEnabled = false;
120+
vscode.window.showInformationMessage(
121+
`Macro is stopped`
122+
);
123+
}
124+
118125
function updateSelections(
119126
selections: vscode.Selection[],
120127
editor: vscode.TextEditor
@@ -194,3 +201,4 @@ function applyContentChange(
194201
edit.replace(change.range, change.text);
195202
}
196203
}
204+

0 commit comments

Comments
 (0)