Skip to content

Commit 6638daf

Browse files
committed
plugin.d.ts: Add explicit path field and adjust types to reflect
See my discussion with Will in the PR.
1 parent 8d3a772 commit 6638daf

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

typings/plugin.d.ts

+42-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as express from "express"
1010
* The homepage of code-server will launch into VS Code. However, there will be an overlay
1111
* button that when clicked, will show all available applications with their names,
1212
* icons and provider plugins. When one clicks on an app's icon, they will be directed
13-
* to <code-server-root>/<plugin-name>/<app-name> to access the application.
13+
* to <code-server-root>/<plugin-path>/<app-path> to access the application.
1414
*/
1515

1616
/**
@@ -51,18 +51,44 @@ import * as express from "express"
5151
/**
5252
* Your plugin module must implement this interface.
5353
*
54-
* The plugin's name, description and version are fetched from its module's package.json
55-
*
56-
* The plugin's router will be mounted at <code-sever-root>/<plugin-name>
54+
* The plugin's router will be mounted at <code-sever-root>/<plugin-path>
5755
*/
5856
export interface Plugin {
57+
/**
58+
* name is used as the plugin's unique identifier.
59+
* No two plugins may share the same name.
60+
*
61+
* Fetched from package.json.
62+
*/
63+
name?: string
64+
65+
/**
66+
* The version for the plugin in the overlay.
67+
*
68+
* Fetched from package.json.
69+
*/
70+
version?: string
71+
72+
/**
73+
* These two are used in the overlay.
74+
*/
75+
displayName: string
76+
description: string
77+
78+
/**
79+
* The path at which the plugin router is to be registered.
80+
*/
81+
path: string
82+
5983
/**
6084
* init is called so that the plugin may initialize itself with the config.
6185
*/
6286
init(config: PluginConfig): void
6387

6488
/**
6589
* Returns the plugin's router.
90+
*
91+
* Mounted at <code-sever-root>/<plugin-path>
6692
*/
6793
router(): express.Router
6894

@@ -90,21 +116,25 @@ export interface PluginConfig {
90116

91117
/**
92118
* Application represents a user accessible application.
93-
*
94-
* When the user clicks on the icon in the overlay, they will be
95-
* redirected to <code-server-root>/<plugin-name>/<app-name>
96-
* where the application should be accessible.
97-
*
98-
* If the app's name is the same as the plugin's name then
99-
* <code-server-root>/<plugin-name> will be used instead.
100119
*/
101120
export interface Application {
102121
readonly name: string
103122
readonly version: string
104123

124+
/**
125+
* When the user clicks on the icon in the overlay, they will be
126+
* redirected to <code-server-root>/<plugin-path>/<app-path>
127+
* where the application should be accessible.
128+
*
129+
* If undefined, then <code-server-root>/<plugin-path> is used.
130+
*/
131+
readonly path?: string
132+
133+
readonly description?: string
134+
105135
/**
106136
* The path at which the icon for this application can be accessed.
107-
* <code-server-root>/<plugin-name>/<app-name>/<icon-path>
137+
* <code-server-root>/<plugin-path>/<app-path>/<icon-path>
108138
*/
109139
readonly iconPath: string
110140
}

0 commit comments

Comments
 (0)