in src/services/cssCompletion.ts [282:354]
public getCompletionsForDeclarationValue(node: nodes.Declaration, result: CompletionList): CompletionList {
const propertyName = node.getFullPropertyName();
const entry = this.cssDataManager.getProperty(propertyName);
let existingNode: nodes.Node | null = node.getValue() || null;
while (existingNode && existingNode.hasChildren()) {
existingNode = existingNode.findChildAtOffset(this.offset, false);
}
this.completionParticipants.forEach(participant => {
if (participant.onCssPropertyValue) {
participant.onCssPropertyValue({
propertyName,
propertyValue: this.currentWord,
range: this.getCompletionRange(existingNode)
});
}
});
if (entry) {
if (entry.restrictions) {
for (const restriction of entry.restrictions) {
switch (restriction) {
case 'color':
this.getColorProposals(entry, existingNode, result);
break;
case 'position':
this.getPositionProposals(entry, existingNode, result);
break;
case 'repeat':
this.getRepeatStyleProposals(entry, existingNode, result);
break;
case 'line-style':
this.getLineStyleProposals(entry, existingNode, result);
break;
case 'line-width':
this.getLineWidthProposals(entry, existingNode, result);
break;
case 'geometry-box':
this.getGeometryBoxProposals(entry, existingNode, result);
break;
case 'box':
this.getBoxProposals(entry, existingNode, result);
break;
case 'image':
this.getImageProposals(entry, existingNode, result);
break;
case 'timing-function':
this.getTimingFunctionProposals(entry, existingNode, result);
break;
case 'shape':
this.getBasicShapeProposals(entry, existingNode, result);
break;
}
}
}
this.getValueEnumProposals(entry, existingNode, result);
this.getCSSWideKeywordProposals(entry, existingNode, result);
this.getUnitProposals(entry, existingNode, result);
} else {
const existingValues = collectValues(this.styleSheet, node);
for (const existingValue of existingValues.getEntries()) {
result.items.push({
label: existingValue,
textEdit: TextEdit.replace(this.getCompletionRange(existingNode), existingValue),
kind: CompletionItemKind.Value
});
}
}
this.getVariableProposals(existingNode, result);
this.getTermProposals(entry, existingNode, result);
return result;
}