Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: `INSTALLATION FAILED: Can't evaluate field ApiVersion #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fResult
Copy link

@fResult fResult commented Sep 21, 2024

From the issue #70.
Fixed an error INSTALLATION FAILED: Can't evaluate field ApiVersion in type interface {}.

After updating code result:
image

P.S. Indeed, if it can be more than 1 specific key, we might be able to do something like this.

// NOTE: Some keys are not just a PascalCase, they can be...
const SPECIAL_KEY_REPLACEMENT: Record<string, string> = {
    apiVersion: 'APIVersion',
    SpecialKey1: 'SPECIALKey1',
    SpecialKey2: 'SPECIALKey2',
    // More special key goes here...
}

export class ChartCompletionItemProvider implements vscode.CompletionItemProvider {
    .
    .
    private getCompletionItemList(currentKey: any): vscode.CompletionItem[] {
        const keys = [];
        for (const key in currentKey) {
            switch (typeof currentKey[key]) {
                .
                .
                case 'number':
                    // NOTE: APIVersion is a special case, as it is not camelCase for `{{ .Chart.APIVersion }}`.
                    const specialText = SPECIAL_KEY_REPLACEMENT[key]
                    const completionText = specialText ?? key.charAt(0).toUpperCase() + key.slice(1);
                    const valueItem = new vscode.CompletionItem(completionText, vscode.CompletionItemKind.Field);
                    valueItem.detail = currentKey[key].toString();
                    keys.push(valueItem);
                    break;
            }
        }
    }
}

@fResult fResult force-pushed the fix/chart-api-version-cannot-be-evaluated branch from 1ac055d to ed17293 Compare September 21, 2024 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant