public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer) { var filename = TemplateProjectionBuffer.GetFilePath(textBuffer); if (filename != null) { var project = DjangoPackage.GetProject(filename); return(new DjangoCompletionSource(_glyphService, project.Analyzer, textBuffer)); } return(null); }
public ProjectBlockCompletionContext(DjangoAnalyzer analyzer, ITextBuffer buffer) : base(analyzer, buffer, TemplateProjectionBuffer.GetFilePath(buffer)) { TemplateProjectionBuffer projBuffer; if (buffer.Properties.TryGetProperty(typeof(TemplateProjectionBuffer), out projBuffer)) { foreach (var span in projBuffer.Spans) { if (span.Block != null) { foreach (var variable in span.Block.GetVariables()) { AddLoopVariable(variable); } } } } }