Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90d46cb

Browse files
committed
plugin.ts: Describe private counterpart functions
Addresses Will's comments.
1 parent 784f543 commit 90d46cb

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/node/plugin.ts

+12
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ export class PluginAPI {
110110
await this._loadPlugins(path.join(__dirname, "../../plugins"))
111111
}
112112

113+
/**
114+
* _loadPlugins is the counterpart to loadPlugins.
115+
*
116+
* It differs in that it loads all plugins in a single
117+
* directory whereas loadPlugins uses all available directories
118+
* as documented.
119+
*/
113120
private async _loadPlugins(dir: string): Promise<void> {
114121
try {
115122
const entries = await fsp.readdir(dir, { withFileTypes: true })
@@ -149,6 +156,11 @@ export class PluginAPI {
149156
}
150157
}
151158

159+
/**
160+
* _loadPlugin is the counterpart to loadPlugin and actually
161+
* loads the plugin now that we know there is no duplicate
162+
* and that the package.json has been read.
163+
*/
152164
private _loadPlugin(dir: string, packageJSON: PackageJSON): Plugin {
153165
dir = path.resolve(dir)
154166

src/node/routes/apps.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as express from "express"
22
import { PluginAPI } from "../plugin"
33

4+
/**
5+
* Implements the /api/applications endpoint
6+
*/
47
export function router(papi: PluginAPI): express.Router {
58
const router = express.Router()
69

test/plugin.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ describe("plugin", () => {
1717
assert.deepEqual(
1818
[
1919
{
20-
name: "test app",
20+
name: "Test App",
2121
version: "4.0.0",
2222

23-
description: "my description",
23+
description: "This app does XYZ.",
2424
iconPath: "/icon.svg",
2525

2626
plugin: {
2727
name: "test-plugin",
2828
version: "1.0.0",
2929
modulePath: path.join(__dirname, "test-plugin"),
3030

31-
description: "Plugin used in code-server tests.",
3231
displayName: "Test Plugin",
32+
description: "Plugin used in code-server tests.",
3333
path: "/test-plugin",
3434
},
3535
},

test/test-plugin/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ export function router(): express.Router {
2121
export function applications(): pluginapi.Application[] {
2222
return [
2323
{
24-
name: "test app",
24+
name: "Test App",
2525
version: "4.0.0",
2626
iconPath: "/icon.svg",
2727

28-
description: "my description",
28+
description: "This app does XYZ.",
2929
},
3030
]
3131
}

0 commit comments

Comments
 (0)