Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-protocol/src/ide-protocol.ts
2498 views
1
/**
2
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
/**
8
* `IDEServer` provides a list of available IDEs.
9
*/
10
export interface IDEServer {
11
/**
12
* Returns the IDE preferences.
13
*/
14
getIDEOptions(): Promise<IDEOptions>;
15
16
/**
17
* Returns the IDE versions.
18
*/
19
getIDEVersions(ide: string): Promise<string[] | undefined>;
20
}
21
22
export interface IDEOptions {
23
/**
24
* A list of available IDEs.
25
*/
26
options: { [key: string]: IDEOption };
27
28
/**
29
* The default (browser) IDE when the user has not specified one.
30
*/
31
defaultIde: string;
32
33
/**
34
* The default desktop IDE when the user has not specified one.
35
*/
36
defaultDesktopIde: string;
37
38
/**
39
* Client specific IDE options.
40
*/
41
clients?: { [id: string]: IDEClient };
42
}
43
44
export namespace IDEOptions {
45
export function asArray(options: IDEOptions): (IDEOption & { id: string })[] {
46
return Object.keys(options.options)
47
.map((id) => ({ ...options.options[id], id }))
48
.sort((a, b) => (a.orderKey || "").localeCompare(b.orderKey || ""));
49
}
50
}
51
52
export const IDESettingsVersion = "2.2";
53
54
export interface IDEClient {
55
/**
56
* The default desktop IDE when the user has not specified one.
57
*/
58
defaultDesktopIDE?: string;
59
60
/**
61
* Desktop IDEs supported by the client.
62
*/
63
desktopIDEs?: string[];
64
65
/**
66
* Steps to install the client on user machine.
67
*/
68
installationSteps?: string[];
69
}
70
71
export interface IDEOption {
72
/**
73
* To ensure a stable order one can set an `orderKey`.
74
*/
75
orderKey?: string;
76
77
/**
78
* Human readable title text of the IDE (plain text only).
79
*/
80
title: string;
81
82
/**
83
* The type of the IDE, currently 'browser' or 'desktop'.
84
*/
85
type: "browser" | "desktop";
86
87
/**
88
* The logo for the IDE. That could be a key in (see
89
* components/dashboard/src/images/ideLogos.ts) or a URL.
90
*/
91
logo: string;
92
93
/**
94
* Text of an optional tooltip (plain text only).
95
*/
96
tooltip?: string;
97
98
/**
99
* Text of an optional label next to the IDE option like “Insiders” (plain
100
* text only).
101
*/
102
label?: string;
103
104
/**
105
* Notes to the IDE option that are rendered in the preferences when a user
106
* chooses this IDE.
107
*/
108
notes?: string[];
109
110
/**
111
* If `true` this IDE option is not visible in the IDE preferences.
112
*/
113
hidden?: boolean;
114
115
/**
116
* If `true` this IDE option is conditionally shown in the IDE preferences
117
*/
118
experimental?: boolean;
119
120
/**
121
* The image ref to the IDE image.
122
*/
123
image: string;
124
125
/**
126
* The latest image ref to the IDE image, this image ref always resolve to digest.
127
*/
128
latestImage?: string;
129
130
/**
131
* When this is `true`, the tag of this image is resolved to the latest
132
* image digest regularly.
133
*
134
* This is useful if this image points to a tag like `nightly` that will be
135
* updated regularly. When `resolveImageDigest` is `true`, we make sure that
136
* we resolve the tag regularly to the most recent image version.
137
*/
138
resolveImageDigest?: boolean;
139
140
/**
141
* The plugin image ref for the IDE image, this image ref always resolve to digest.
142
*/
143
pluginImage?: string;
144
145
/**
146
* The latest plugin image ref for the latest IDE image, this image ref always resolve to digest.
147
*/
148
pluginLatestImage?: string;
149
150
/**
151
* ImageVersion the semantic version of the IDE image.
152
*/
153
imageVersion?: string;
154
155
/**
156
* LatestImageVersion the semantic version of the latest IDE image.
157
*/
158
latestImageVersion?: string;
159
160
/**
161
* Wether is possible to pin a specific IDE version.
162
*/
163
pinnable?: boolean;
164
}
165
166