Skip to content

Commit

Permalink
feat: support multiple custom kubernetes urls
Browse files Browse the repository at this point in the history
  • Loading branch information
tricktron committed Mar 24, 2023
1 parent 268fef3 commit 679dbee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@
"default": [],
"description": "Custom tags for the parser to use"
},
"yaml.kubernetesSchemaURLs": {
"type": "array",
"default": [],
"description": "URLs to Kubernetes schemas"
},
"yaml.schemaStore.enable": {
"type": "boolean",
"default": true,
Expand Down
11 changes: 11 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ namespace DynamicCustomSchemaRequestRegistration {
export const type: NotificationType<{}> = new NotificationType('yaml/registerCustomSchemaRequest');
}

// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace KubernetesSchemaURLsNotification {
// eslint-disable-next-line @typescript-eslint/ban-types
export const type: NotificationType<string[]> = new NotificationType('yaml/kubernetesSchemaURLs');
}

// eslint-disable-next-line @typescript-eslint/no-namespace
namespace ResultLimitReachedNotification {
// eslint-disable-next-line @typescript-eslint/ban-types
Expand Down Expand Up @@ -161,6 +167,7 @@ export function startClient(
client.sendNotification(SchemaAssociationNotification.type, getSchemaAssociations());
findConflicts();
});
client.sendNotification(KubernetesSchemaURLsNotification.type, getKubernetesSchemaURLs());
// Tell the server that the client is ready to provide custom schema content
client.sendNotification(DynamicCustomSchemaRequestRegistration.type);
// Tell the server that the client supports schema requests sent directly to it
Expand Down Expand Up @@ -229,6 +236,10 @@ function findConflicts(): void {
}
}

function getKubernetesSchemaURLs(): string[] {
return workspace.getConfiguration('yaml').get('kubernetesSchemaURLs') || [];
}

function getSchemaAssociations(): ISchemaAssociation[] {
const associations: ISchemaAssociation[] = [];
extensions.all.forEach((extension) => {
Expand Down

0 comments on commit 679dbee

Please sign in to comment.