public bool accept(HQLCompletionProposal proposal) { suggestions.Add(proposal.GetCompletion()); return true; }
public bool Accept(HQLCompletionProposal proposal) { Console.WriteLine(proposal.ToString()); proposals.Add(proposal); return false; }
public bool accept(HQLCompletionProposal proposal) { Proposals.Add(proposal); return true; }
public void CodeComplete(string query, int position, IHQLCompletionRequestor collector) { int prefixStart = FindNearestWhiteSpace(query, position); string prefix = query.Substring( prefixStart, position-prefixStart ); bool showEntityNames; try { showEntityNames = new HQLAnalyzer().ShouldShowEntityNames( query, position ); if(showEntityNames) { if(HasConfiguration()) { completion.GetMatchingImports( prefix, position, collector ); } else { collector.CompletionFailure("Configuration not available nor open"); } } else { List<EntityNameReference> visible = new HQLAnalyzer().GetVisibleEntityNames( query, position ); int dotIndex = prefix.LastIndexOf("."); if (dotIndex == -1) { // It's a simple path, not a dot separated one (find aliases that matches) foreach (EntityNameReference qt in visible) { string alias = qt.Alias; if (alias.StartsWith(prefix)) { var completionProposal = new HQLCompletionProposal(CompletionKind.AliasRef, position) { Completion = alias.Substring(prefix.Length), ReplaceStart = position, ReplaceEnd = position + 0, SimpleName = alias, ShortEntityName = qt.EntityName }; if(HasConfiguration()) { string importedName; if(GetConfiguration().Imports.TryGetValue(qt.EntityName, out importedName)) { completionProposal.EntityName = importedName; } } collector.Accept( completionProposal ); } } } else { if(HasConfiguration()) { string path = CompletionHelper.getCanonicalPath(visible, prefix.Substring(0, dotIndex)); string propertyPrefix = prefix.Substring(dotIndex + 1); completion.GetMatchingProperties( path, propertyPrefix, position, collector ); } else { collector.CompletionFailure("Configuration not available nor open"); } } completion.GetMatchingFunctions( prefix, position, collector ); completion.GetMatchingKeywords( prefix, position, collector ); } } catch(SimpleLexerException sle) { collector.CompletionFailure( "Syntax error: " + sle.Message ); } }
public HQLCompletionData(HQLCompletionProposal proposal) { this.proposal = proposal; }