Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9139d8f

Browse files
committed
refactor activate/deactivate
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentcfd92c7 commit9139d8f

File tree

2 files changed

+41
-53
lines changed

2 files changed

+41
-53
lines changed

‎src/editor/index.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

‎src/extension.ts

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
1-
importEditorfrom'./editor'
1+
import*asvscodefrom'vscode'
2+
import{createCommands}from'./editor/commands'
3+
import*astelemetryfrom'./services/telemetry'
24

3-
// vscode editor
4-
exportconsteditor=newEditor()
5+
letonDeactivate=()=>{}
56

67
// activate run on vscode extension initialization
7-
exportconstactivate=editor.activate
8+
exportconstactivate=(vscodeExt:vscode.ExtensionContext):void=>{
9+
// set out default 60/40 layout
10+
vscode.commands.executeCommand('vscode.setEditorLayout',{
11+
orientation:0,
12+
groups:[{size:0.6},{size:0.4}],
13+
})
14+
15+
// commands
16+
constcommands=createCommands({
17+
extensionPath:vscodeExt.extensionPath,
18+
// NOTE: local storage must be bound to the vscodeExt.workspaceState
19+
workspaceState:vscodeExt.workspaceState,
20+
})
21+
22+
constsubscribe=(sub:any)=>{
23+
vscodeExt.subscriptions.push(sub)
24+
}
25+
26+
// register commands
27+
for(constcmdincommands){
28+
constcommand:vscode.Disposable=vscode.commands.registerCommand(cmd,commands[cmd])
29+
subscribe(command)
30+
}
31+
32+
telemetry.activate(subscribe)
33+
34+
onDeactivate=()=>{
35+
// cleanup subscriptions/tasks
36+
// handled within activate because it requires access to subscriptions
37+
for(constdisposableofvscodeExt.subscriptions){
38+
disposable.dispose()
39+
}
40+
41+
telemetry.deactivate()
42+
}
43+
}
844

945
// deactivate run on vscode extension shut down
10-
exportconstdeactivate=editor.deactivate
46+
exportconstdeactivate=():void=>onDeactivate()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp