@pooder/core 1.1.0 → 2.0.0
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +33 -2
- package/dist/index.mjs +30 -1
- package/package.json +1 -1
- package/src/command.ts +10 -10
- package/src/context.ts +17 -17
- package/src/contribution/index.ts +12 -12
- package/src/contribution/points.ts +8 -1
- package/src/contribution/registry.ts +118 -118
- package/src/disposable.ts +3 -3
- package/src/extension.ts +164 -164
- package/src/index.ts +145 -140
- package/src/run-test-full.ts +98 -98
- package/src/services/CommandService.ts +79 -79
- package/src/services/ConfigurationService.ts +107 -107
- package/src/services/WorkbenchService.ts +30 -0
- package/src/services/index.ts +2 -1
- package/src/test-extension-full.ts +79 -79
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { ExtensionContext } from "./context";
|
|
2
|
-
import {
|
|
3
|
-
ContributionPointIds,
|
|
4
|
-
CommandContribution,
|
|
5
|
-
ToolContribution,
|
|
6
|
-
ViewContribution,
|
|
7
|
-
} from "./contribution";
|
|
8
|
-
import { Extension } from "./extension";
|
|
9
|
-
import CommandService from "./services/CommandService";
|
|
10
|
-
|
|
11
|
-
export const fullExtension: Extension = {
|
|
12
|
-
id: "full-feature-test-extension",
|
|
13
|
-
metadata: {
|
|
14
|
-
name: "Full Feature Test Extension",
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
activate(context: ExtensionContext) {
|
|
18
|
-
console.log("Full Feature Test Extension activated!");
|
|
19
|
-
|
|
20
|
-
// Manually register a command (imperative way)
|
|
21
|
-
const commandService =
|
|
22
|
-
context.services.get<CommandService>("CommandService");
|
|
23
|
-
commandService!.registerCommand("test.imperative.hello", (name: string) => {
|
|
24
|
-
return `Hello Imperative ${name}`;
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
deactivate(context: ExtensionContext) {
|
|
29
|
-
console.log("Full Feature Test Extension deactivated!");
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
contribute() {
|
|
33
|
-
return {
|
|
34
|
-
// 1. Command Contributions
|
|
35
|
-
[ContributionPointIds.COMMANDS]: [
|
|
36
|
-
// Declarative command with handler (auto-registered by our updated ExtensionManager)
|
|
37
|
-
{
|
|
38
|
-
id: "test.declarative.auto",
|
|
39
|
-
command: "test.declarative.auto",
|
|
40
|
-
title: "Auto Registered Command",
|
|
41
|
-
handler: () => {
|
|
42
|
-
return "Auto Registered Result";
|
|
43
|
-
},
|
|
44
|
-
} as CommandContribution,
|
|
45
|
-
|
|
46
|
-
// Declarative command without handler (just definition, maybe handled elsewhere)
|
|
47
|
-
{
|
|
48
|
-
id: "test.declarative.no-handler",
|
|
49
|
-
command: "test.declarative.no-handler",
|
|
50
|
-
title: "No Handler Command",
|
|
51
|
-
} as CommandContribution,
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
// 2. Tool Contributions
|
|
55
|
-
[ContributionPointIds.TOOLS]: [
|
|
56
|
-
{
|
|
57
|
-
id: "test.tool.calculator",
|
|
58
|
-
name: "Calculator",
|
|
59
|
-
description: "Simple calculator",
|
|
60
|
-
execute: async (op: string, a: number, b: number) => {
|
|
61
|
-
if (op === "add") return a + b;
|
|
62
|
-
return 0;
|
|
63
|
-
},
|
|
64
|
-
} as ToolContribution,
|
|
65
|
-
],
|
|
66
|
-
|
|
67
|
-
// 3. View Contributions
|
|
68
|
-
[ContributionPointIds.VIEWS]: [
|
|
69
|
-
{
|
|
70
|
-
id: "test.view.sidebar",
|
|
71
|
-
name: "Test Sidebar",
|
|
72
|
-
type: "sidebar",
|
|
73
|
-
component: "SidebarComponent", // Mock component string
|
|
74
|
-
location: "left",
|
|
75
|
-
} as ViewContribution,
|
|
76
|
-
],
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
};
|
|
1
|
+
import { ExtensionContext } from "./context";
|
|
2
|
+
import {
|
|
3
|
+
ContributionPointIds,
|
|
4
|
+
CommandContribution,
|
|
5
|
+
ToolContribution,
|
|
6
|
+
ViewContribution,
|
|
7
|
+
} from "./contribution";
|
|
8
|
+
import { Extension } from "./extension";
|
|
9
|
+
import CommandService from "./services/CommandService";
|
|
10
|
+
|
|
11
|
+
export const fullExtension: Extension = {
|
|
12
|
+
id: "full-feature-test-extension",
|
|
13
|
+
metadata: {
|
|
14
|
+
name: "Full Feature Test Extension",
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
activate(context: ExtensionContext) {
|
|
18
|
+
console.log("Full Feature Test Extension activated!");
|
|
19
|
+
|
|
20
|
+
// Manually register a command (imperative way)
|
|
21
|
+
const commandService =
|
|
22
|
+
context.services.get<CommandService>("CommandService");
|
|
23
|
+
commandService!.registerCommand("test.imperative.hello", (name: string) => {
|
|
24
|
+
return `Hello Imperative ${name}`;
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
deactivate(context: ExtensionContext) {
|
|
29
|
+
console.log("Full Feature Test Extension deactivated!");
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
contribute() {
|
|
33
|
+
return {
|
|
34
|
+
// 1. Command Contributions
|
|
35
|
+
[ContributionPointIds.COMMANDS]: [
|
|
36
|
+
// Declarative command with handler (auto-registered by our updated ExtensionManager)
|
|
37
|
+
{
|
|
38
|
+
id: "test.declarative.auto",
|
|
39
|
+
command: "test.declarative.auto",
|
|
40
|
+
title: "Auto Registered Command",
|
|
41
|
+
handler: () => {
|
|
42
|
+
return "Auto Registered Result";
|
|
43
|
+
},
|
|
44
|
+
} as CommandContribution,
|
|
45
|
+
|
|
46
|
+
// Declarative command without handler (just definition, maybe handled elsewhere)
|
|
47
|
+
{
|
|
48
|
+
id: "test.declarative.no-handler",
|
|
49
|
+
command: "test.declarative.no-handler",
|
|
50
|
+
title: "No Handler Command",
|
|
51
|
+
} as CommandContribution,
|
|
52
|
+
],
|
|
53
|
+
|
|
54
|
+
// 2. Tool Contributions
|
|
55
|
+
[ContributionPointIds.TOOLS]: [
|
|
56
|
+
{
|
|
57
|
+
id: "test.tool.calculator",
|
|
58
|
+
name: "Calculator",
|
|
59
|
+
description: "Simple calculator",
|
|
60
|
+
execute: async (op: string, a: number, b: number) => {
|
|
61
|
+
if (op === "add") return a + b;
|
|
62
|
+
return 0;
|
|
63
|
+
},
|
|
64
|
+
} as ToolContribution,
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
// 3. View Contributions
|
|
68
|
+
[ContributionPointIds.VIEWS]: [
|
|
69
|
+
{
|
|
70
|
+
id: "test.view.sidebar",
|
|
71
|
+
name: "Test Sidebar",
|
|
72
|
+
type: "sidebar",
|
|
73
|
+
component: "SidebarComponent", // Mock component string
|
|
74
|
+
location: "left",
|
|
75
|
+
} as ViewContribution,
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
};
|