示例#1
0
        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);
        }
示例#2
0
        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);
                        }
                    }
                }
            }
        }