private getContributedValueCompletions()

in language-service/src/services/yamlCompletion.ts [380:407]


    private getContributedValueCompletions(doc: Parser.JSONDocument, node: Parser.ASTNode, offset: number, document: TextDocument, collector: CompletionsCollector, collectionPromises: Thenable<any>[]) {
        if (!node) {
            this.contributions.forEach((contribution) => {
                let collectPromise = contribution.collectDefaultCompletions(document.uri, collector);
                if (collectPromise) {
                    collectionPromises.push(collectPromise);
                }
            });
        } else {
            if (node.type === 'string' || node.type === 'number' || node.type === 'boolean' || node.type === 'null') {
                node = node.parent;
            }
            if ((node.type === 'property') && offset > (<Parser.PropertyASTNode>node).colonOffset) {
                let parentKey = (<Parser.PropertyASTNode>node).key.value;

                let valueNode = (<Parser.PropertyASTNode>node).value;
                if (!valueNode || offset <= valueNode.end) {
                    let location = node.parent.getPath();
                    this.contributions.forEach((contribution) => {
                        let collectPromise = contribution.collectValueCompletions(document.uri, location, parentKey, collector);
                        if (collectPromise) {
                            collectionPromises.push(collectPromise);
                        }
                    });
                }
            }
        }
    }