forked from sweetpad-dev/sweetpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.ts
102 lines (88 loc) · 4.3 KB
/
extension.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import * as vscode from "vscode";
import { BuildTreeProvider } from "./build/tree.js";
import {
launchCommand,
buildCommand,
cleanCommand,
generateBuildServerConfigCommand,
openXcodeCommand,
removeBundleDirCommand,
resolveDependenciesCommand,
} from "./build/commands.js";
import { formatCommand, showLogsCommand } from "./format/commands.js";
import { createFormatStatusItem } from "./format/status.js";
import { createFormatProvider } from "./format/provider.js";
import {
openSimulatorCommand,
removeSimulatorCacheCommand,
startSimulatorCommand,
stopSimulatorCommand,
} from "./simulators/commands.js";
import { SimulatorsTreeProvider } from "./simulators/tree.js";
import { ToolTreeProvider } from "./tools/tree.js";
import { installToolCommand, openDocumentationCommand } from "./tools/commands.js";
import { ExtensionContext } from "./common/commands.js";
import { selectXcodeWorkspaceCommand } from "./build/commands.js";
import { createIssueGenericCommand, createIssueNoSchemesCommand, resetSweetpadCache } from "./system/commands.js";
import { XcodeBuildTaskProvider } from "./build/provider.js";
import { xcodgenGenerateCommand } from "./xcodegen/commands.js";
import { createXcodeGenWatcher } from "./xcodegen/watcher.js";
import { registerDebugConfigurationProvider } from "./debugger/provider.js";
import { getAppPathCommand } from "./debugger/commands.js";
export function activate(context: vscode.ExtensionContext) {
// Trees 🎄
const simulatorsTreeProvider = new SimulatorsTreeProvider();
const buildTreeProvider = new BuildTreeProvider();
const toolsTreeProvider = new ToolTreeProvider();
const _context = new ExtensionContext({
context: context,
buildProvider: buildTreeProvider,
simulatorsProvider: simulatorsTreeProvider,
toolsProvider: toolsTreeProvider,
});
// shortcut to push disposable to context.subscriptions
const d = _context.disposable.bind(_context);
const command = _context.registerCommand.bind(_context);
const buildTaskProvider = new XcodeBuildTaskProvider(_context);
// Debug
d(registerDebugConfigurationProvider(_context));
d(command("sweetpad.debugger.getAppPath", getAppPathCommand));
// Tasks
d(vscode.tasks.registerTaskProvider(buildTaskProvider.type, buildTaskProvider));
// Build
d(vscode.window.registerTreeDataProvider("sweetpad.build.view", buildTreeProvider));
d(command("sweetpad.build.refresh", async () => buildTreeProvider.refresh()));
d(command("sweetpad.build.launch", launchCommand));
d(command("sweetpad.build.build", buildCommand));
d(command("sweetpad.build.clean", cleanCommand));
d(command("sweetpad.build.resolveDependencies", resolveDependenciesCommand));
d(command("sweetpad.build.removeBundleDir", removeBundleDirCommand));
d(command("sweetpad.build.genereateBuildServerConfig", generateBuildServerConfigCommand));
d(command("sweetpad.build.openXcode", openXcodeCommand));
d(command("sweetpad.build.selectXcodeWorkspace", selectXcodeWorkspaceCommand));
// XcodeGen
d(command("sweetpad.xcodegen.generate", xcodgenGenerateCommand));
d(createXcodeGenWatcher(_context));
// Format
d(createFormatStatusItem());
d(createFormatProvider());
d(command("sweetpad.format.run", formatCommand));
d(command("sweetpad.format.showLogs", showLogsCommand));
// Simulators
d(vscode.window.registerTreeDataProvider("sweetpad.simulators.view", simulatorsTreeProvider));
d(command("sweetpad.simulators.refresh", async () => simulatorsTreeProvider.refresh()));
d(command("sweetpad.simulators.openSimulator", openSimulatorCommand));
d(command("sweetpad.simulators.removeCache", removeSimulatorCacheCommand));
d(command("sweetpad.simulators.start", startSimulatorCommand));
d(command("sweetpad.simulators.stop", stopSimulatorCommand));
// Tools
d(vscode.window.registerTreeDataProvider("sweetpad.tools.view", toolsTreeProvider));
d(command("sweetpad.tools.install", installToolCommand));
d(command("sweetpad.tools.refresh", async () => toolsTreeProvider.refresh()));
d(command("sweetpad.tools.documentation", openDocumentationCommand));
// System
d(command("sweetpad.system.resetSweetpadCache", resetSweetpadCache));
d(command("sweetpad.system.createIssue.generic", createIssueGenericCommand));
d(command("sweetpad.system.createIssue.noSchemes", createIssueNoSchemesCommand));
}
export function deactivate() {}