protected void createFollowElementBasedProposals( final CompletionParameters parameters, final CompletionResultSet result) { boolean _or = false; boolean _isEmpty = this.myFollowElementBasedContributors.isEmpty(); if (_isEmpty) { _or = true; } else { CompletionType _completionType = parameters.getCompletionType(); boolean _containsKey = this.myFollowElementBasedContributors.containsKey(_completionType); boolean _not = (!_containsKey); _or = _not; } if (_or) { return; } Editor _editor = parameters.getEditor(); int _offset = parameters.getOffset(); final TokenSet tokenSet = this._tokenSetProvider.getTokenSet(((EditorEx) _editor), _offset); CompletionType _completionType_1 = parameters.getCompletionType(); Map<TokenSet, Multimap<AbstractElement, CompletionProvider<CompletionParameters>>> _get = this.myFollowElementBasedContributors.get(_completionType_1); final Multimap<AbstractElement, CompletionProvider<CompletionParameters>> element2provider = _get.get(tokenSet); boolean _equals = Objects.equal(element2provider, null); if (_equals) { return; } final Set<AbstractElement> followElements = this.computeFollowElements(parameters); final HashSet<CompletionProvider<CompletionParameters>> calledProviders = CollectionLiterals.<CompletionProvider<CompletionParameters>>newHashSet(); Set<AbstractElement> _keySet = element2provider.keySet(); for (final AbstractElement followElement : _keySet) { { final ProcessingContext context = new ProcessingContext(); boolean _contains = followElements.contains(followElement); if (_contains) { final Collection<CompletionProvider<CompletionParameters>> providers = element2provider.get(followElement); for (final CompletionProvider<CompletionParameters> provider : providers) { boolean _add = calledProviders.add(provider); if (_add) { provider.addCompletionVariants(parameters, context, result); boolean _isStopped = result.isStopped(); if (_isStopped) { return; } } } } } } }
protected Set<AbstractElement> computeFollowElements(final CompletionParameters parameters) { Editor _editor = parameters.getEditor(); Document _document = _editor.getDocument(); PsiElement _position = parameters.getPosition(); ASTNode _node = _position.getNode(); int _startOffset = _node.getStartOffset(); TextRange _textRange = new TextRange(0, _startOffset); final String text = _document.getText(_textRange); final Collection<FollowElement> followElements = this.contentAssistParser.getFollowElements(text, false); final HashSet<AbstractElement> allElements = CollectionLiterals.<AbstractElement>newHashSet(); this.followElementComputer.computeFollowElements(followElements, allElements); return allElements; }
@Override public void fillCompletionVariants( @NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { Project project = parameters.getEditor().getProject(); assert project != null; JsonSchemaService service = JsonSchemaService.Impl.get(project); assert service != null; CompletionContributor delegate = service.getCompletionContributor(parameters.getOriginalFile().getVirtualFile()); if (delegate != null) { delegate.fillCompletionVariants(parameters, result); } }
protected void createParserBasedProposals( final CompletionParameters parameters, final CompletionResultSet result) { Editor _editor = parameters.getEditor(); int _offset = parameters.getOffset(); final TokenSet tokenSet = this._tokenSetProvider.getTokenSet(((EditorEx) _editor), _offset); boolean _supportParserBasedProposals = this.supportParserBasedProposals(tokenSet); boolean _not = (!_supportParserBasedProposals); if (_not) { return; } final ContentAssistContextFactory delegate = this.getParserBasedDelegate(); boolean _equals = Objects.equal(delegate, null); if (_equals) { return; } String _text = this.getText(parameters); TextRegion _selection = this.getSelection(parameters); int _offset_1 = parameters.getOffset(); XtextResource _resource = this.getResource(parameters); final ContentAssistContext[] contexts = delegate.create(_text, _selection, _offset_1, _resource); final Procedure1<ContentAssistContext> _function = new Procedure1<ContentAssistContext>() { @Override public void apply(final ContentAssistContext c) { ImmutableList<AbstractElement> _firstSetGrammarElements = c.getFirstSetGrammarElements(); final Procedure1<AbstractElement> _function = new Procedure1<AbstractElement>() { @Override public void apply(final AbstractElement e) { AbstractCompletionContributor.this.createProposal(e, c, parameters, result); } }; IterableExtensions.<AbstractElement>forEach(_firstSetGrammarElements, _function); } }; IterableExtensions.<ContentAssistContext>forEach( ((Iterable<ContentAssistContext>) Conversions.doWrapArray(contexts)), _function); }