Skip to content

Commit 0bf5623

Browse files
Merge pull request #912 from tricktron/f-custom-kubernetes-urls
Support Multiple Custom Kubernetes Versions and CRDs
2 parents 1e22ef3 + 679dbee commit 0bf5623

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@
166166
"default": [],
167167
"description": "Custom tags for the parser to use"
168168
},
169+
"yaml.kubernetesSchemaURLs": {
170+
"type": "array",
171+
"default": [],
172+
"description": "URLs to Kubernetes schemas"
173+
},
169174
"yaml.schemaStore.enable": {
170175
"type": "boolean",
171176
"default": true,

src/extension.ts

+11
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ namespace DynamicCustomSchemaRequestRegistration {
7474
export const type: NotificationType<{}> = new NotificationType('yaml/registerCustomSchemaRequest');
7575
}
7676

77+
// eslint-disable-next-line @typescript-eslint/no-namespace
78+
export namespace KubernetesSchemaURLsNotification {
79+
// eslint-disable-next-line @typescript-eslint/ban-types
80+
export const type: NotificationType<string[]> = new NotificationType('yaml/kubernetesSchemaURLs');
81+
}
82+
7783
// eslint-disable-next-line @typescript-eslint/no-namespace
7884
namespace ResultLimitReachedNotification {
7985
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -161,6 +167,7 @@ export function startClient(
161167
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations());
162168
findConflicts();
163169
});
170+
client.sendNotification(KubernetesSchemaURLsNotification.type, getKubernetesSchemaURLs());
164171
// Tell the server that the client is ready to provide custom schema content
165172
client.sendNotification(DynamicCustomSchemaRequestRegistration.type);
166173
// Tell the server that the client supports schema requests sent directly to it
@@ -229,6 +236,10 @@ function findConflicts(): void {
229236
}
230237
}
231238

239+
function getKubernetesSchemaURLs(): string[] {
240+
return workspace.getConfiguration('yaml').get('kubernetesSchemaURLs') || [];
241+
}
242+
232243
function getSchemaAssociations(): ISchemaAssociation[] {
233244
const associations: ISchemaAssociation[] = [];
234245
extensions.all.forEach((extension) => {

0 commit comments

Comments
 (0)