mirror of https://git.tuxpa.in/a/code-server.git
plugin.d.ts: Document plugin priority correctly
This commit is contained in:
parent
75e52a3774
commit
8d3a7721fe
|
@ -89,8 +89,12 @@ export class PluginAPI {
|
||||||
* this.csPluginPath and the built in plugins.
|
* this.csPluginPath and the built in plugins.
|
||||||
*/
|
*/
|
||||||
public async loadPlugins(): Promise<void> {
|
public async loadPlugins(): Promise<void> {
|
||||||
// Built-in plugins.
|
for (const dir of this.csPlugin.split(":")) {
|
||||||
await this._loadPlugins(path.join(__dirname, "../../plugins"))
|
if (!dir) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
await this.loadPlugin(dir)
|
||||||
|
}
|
||||||
|
|
||||||
for (const dir of this.csPluginPath.split(":")) {
|
for (const dir of this.csPluginPath.split(":")) {
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
|
@ -99,12 +103,8 @@ export class PluginAPI {
|
||||||
await this._loadPlugins(dir)
|
await this._loadPlugins(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const dir of this.csPlugin.split(":")) {
|
// Built-in plugins.
|
||||||
if (!dir) {
|
await this._loadPlugins(path.join(__dirname, "../../plugins"))
|
||||||
continue
|
|
||||||
}
|
|
||||||
await this.loadPlugin(dir)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadPlugins(dir: string): Promise<void> {
|
private async _loadPlugins(dir: string): Promise<void> {
|
||||||
|
|
|
@ -18,7 +18,12 @@ import * as express from "express"
|
||||||
*
|
*
|
||||||
* Plugins are just node modules.
|
* Plugins are just node modules.
|
||||||
*
|
*
|
||||||
* code-server uses $CS_PLUGIN_PATH to find plugins. Each subdirectory in
|
* 1. code-server uses $CS_PLUGIN to find plugins.
|
||||||
|
*
|
||||||
|
* e.g. CS_PLUGIN=/tmp/will:/tmp/teffen will cause code-server to load
|
||||||
|
* /tmp/will and /tmp/teffen as plugins.
|
||||||
|
*
|
||||||
|
* 2. code-server uses $CS_PLUGIN_PATH to find plugins. Each subdirectory in
|
||||||
* $CS_PLUGIN_PATH with a package.json where the engine is code-server is
|
* $CS_PLUGIN_PATH with a package.json where the engine is code-server is
|
||||||
* a valid plugin.
|
* a valid plugin.
|
||||||
*
|
*
|
||||||
|
@ -29,16 +34,14 @@ import * as express from "express"
|
||||||
* ~/.local/share/code-server/plugins:/usr/share/code-server/plugins
|
* ~/.local/share/code-server/plugins:/usr/share/code-server/plugins
|
||||||
* if unset.
|
* if unset.
|
||||||
*
|
*
|
||||||
* code-server also uses $CS_PLUGIN to find plugins.
|
|
||||||
*
|
*
|
||||||
* e.g. CS_PLUGIN=/tmp/will:/tmp/teffen will cause code-server to load
|
* 3. Built in plugins are loaded from __dirname/../plugins
|
||||||
* /tmp/will and /tmp/teffen as plugins.
|
|
||||||
*
|
*
|
||||||
* Built in plugins are also loaded from __dirname/../plugins
|
* Plugins are required as soon as they are found and then initialized.
|
||||||
|
* See the Plugin interface for details.
|
||||||
*
|
*
|
||||||
* Priority is $CS_PLUGIN, $CS_PLUGIN_PATH and then the builtin plugins.
|
* If two plugins are found with the exact same name, then code-server will
|
||||||
* After the search is complete, plugins will be required in first found order and
|
* use the first one and emit a warning.
|
||||||
* initialized. See the Plugin interface for details.
|
|
||||||
*
|
*
|
||||||
* There is also a /api/applications endpoint to allow programmatic access to all
|
* There is also a /api/applications endpoint to allow programmatic access to all
|
||||||
* available applications. It could be used to create a custom application dashboard
|
* available applications. It could be used to create a custom application dashboard
|
||||||
|
@ -51,9 +54,6 @@ import * as express from "express"
|
||||||
* The plugin's name, description and version are fetched from its module's package.json
|
* The plugin's name, description and version are fetched from its module's package.json
|
||||||
*
|
*
|
||||||
* The plugin's router will be mounted at <code-sever-root>/<plugin-name>
|
* The plugin's router will be mounted at <code-sever-root>/<plugin-name>
|
||||||
*
|
|
||||||
* If two plugins are found with the exact same name, then code-server will
|
|
||||||
* use the last one and emit a warning.
|
|
||||||
*/
|
*/
|
||||||
export interface Plugin {
|
export interface Plugin {
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue