@Override public boolean addProposals(String text, TaskDefinition taskDefinition, int detailLevel, List<CompletionProposal> collector) { Set<String> parameterNames = new HashSet<>(taskDefinition.getProperties().keySet()); parameterNames.removeAll(CompletionUtils.IMPLICIT_TASK_PARAMETER_NAMES); if (!parameterNames.isEmpty() || !text.endsWith(taskDefinition.getRegisteredAppName())) { return false; } // Actually add completions String alreadyTyped = taskDefinition.getRegisteredAppName(); CompletionProposal.Factory proposals = CompletionProposal.expanding(text); List<ApplicationType> validTypesAtThisPosition = Arrays.asList(ApplicationType.task); for (AppRegistration appRegistration : appRegistry.findAll()) { String candidateName = appRegistration.getName(); if (validTypesAtThisPosition.contains(appRegistration.getType()) && !alreadyTyped.equals(candidateName) && candidateName.startsWith(alreadyTyped)) { String expansion = appRegistration.getName(); collector.add(proposals.withSuffix(expansion.substring(alreadyTyped.length()))); } } return false; } }
String expansion = CompletionUtils.maybeQualifyWithLabel(appRegistration.getName(), streamDefinition); collector.add(proposals.withSuffix(expansion.substring(alreadyTyped.length())));
for (ModuleDefinition moduleDefinition : streamDefinition.getModuleDefinitions()) { if (moduleDefinition.getLabel().startsWith(moduleName)) { collector.add(proposals.withSuffix(moduleDefinition.getLabel())); for (StreamDefinition stream : streamDefinitionRepository.findAll()) { if (stream.getName().startsWith(streamName)) { collector.add(proposals.withSuffix(stream.getName()));
if (streamAppDefinition.getName().startsWith(appName) && !applicationType.equals(ApplicationType.sink)) { collector.add(proposals.withSuffix(streamAppDefinition.getName())); for (StreamDefinition stream : streamDefinitionRepository.findAll()) { if (stream.getName().startsWith(streamName)) { collector.add(proposals.withSuffix(stream.getName()));
String candidate = String.valueOf(valueHint.getValue()); if (!candidate.equals(alreadyTyped) && candidate.startsWith(alreadyTyped)) { collector.add(proposals.withSuffix(candidate.substring(alreadyTyped.length()), valueHint.getShortDescription()));
if (streamAppDefinition.getName().startsWith(appName) && !applicationType.equals(ApplicationType.sink)) { collector.add(proposals.withSuffix(streamAppDefinition.getName())); for (StreamDefinition stream : streamDefinitionRepository.findAll()) { if (stream.getName().startsWith(streamName)) { collector.add(proposals.withSuffix(stream.getName()));
void addValueHintsProposals(final String dsl, AppRegistration appRegistration, final List<CompletionProposal> collector, final String propertyName, final ValueHintProvider[] valueHintProviders){ final Resource metadataResource = this.appRegistry.getAppMetadataResource(appRegistration); if (metadataResource != null) { final URLClassLoader classLoader = metadataResolver.createAppClassLoader(metadataResource); this.doWithClassLoader(classLoader, () -> { CompletionProposal.Factory proposals = CompletionProposal.expanding(dsl); List<ConfigurationMetadataProperty> whiteList = metadataResolver.listProperties(metadataResource); for (ConfigurationMetadataProperty property : metadataResolver.listProperties(metadataResource, true)) { if (CompletionUtils.isMatchingProperty(propertyName, property, whiteList)) { for (ValueHintProvider valueHintProvider : valueHintProviders) { for (ValueHint valueHint : valueHintProvider.generateValueHints(property, classLoader)) { collector.add(proposals.withSuffix(String.valueOf(valueHint.getValue()), valueHint.getShortDescription())); } } } } return null; }); } }
public CompletionProposal withSuffix(String suffix) { return withSuffix(suffix, null); }