Пример #1
0
        /// <summary>
        /// Completion set constructor - only called from the Create method
        /// </summary>
        /// <param name="node"></param>
        /// <param name="point"></param>
        internal CompletionSet(DesignerNode node, SnapshotPoint point)
            : base("Django Completions", null, null, null)
        {
            // calculate the span to be replaced with user selection
            Span span = new Span(point.Position, 0);
            if (node.SnapshotSpan.IntersectsWith(span))
                span = node.SnapshotSpan.Span;
            ApplicableTo = point.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeInclusive);

            // claculate the filter span (see above)
            filterSpan = point.Snapshot.CreateTrackingSpan(span.Start, point.Position - span.Start, SpanTrackingMode.EdgeInclusive);

            this.node = node;
        }
Пример #2
0
 protected override void Initialize(Source source, DesignerNode node, SnapshotPoint point)
 {
     base.Initialize(source, node, point);
     switch (source.Context)
     {
         case CompletionContext.QuotedString:
             quote_char = '"';
             break;
         case CompletionContext.AposString:
             quote_char = '\'';
             break;
         default:
             System.Diagnostics.Debug.Assert(true, "Contexts other than QuotedString and AposString are not allowed, context=" + source.Context.ToString());
             break;
     }
     source.Session.Committed += new EventHandler(Session_Committed);
 }
Пример #3
0
        /// <summary>
        /// Creates the designer (proxy) node over the real syntax node passed in as a parameter
        /// Also recursively creates child nodes for all 'real' node children
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="snapshot"></param>
        /// <param name="node"></param>
        public DesignerNode(NodeProvider provider, DesignerNode parent, ITextSnapshot snapshot, INode node)
        {
            this.Provider = provider;
            Parent        = parent;
            this.node     = node;
            if (node.NodeType == NodeType.ParsingContext)
            {
                snapshotSpan  = new SnapshotSpan(snapshot, node.Position + node.Length, 0);
                extensionSpan = new SnapshotSpan(snapshot, node.Position, node.Length);
            }
            else
            {
                snapshotSpan = new SnapshotSpan(snapshot, node.Position, node.Length);
                int offset = 0;
                if (IsCompletionProvider)
                {
                    ITextSnapshotLine line = snapshot.GetLineFromPosition(node.Position);

                    // if the Value list is not empty, expand the snapshotSpan
                    // to include leading whitespaces, so that when a user
                    // types smth in this space he will get the dropdown
                    for (; node.Position - offset > line.Extent.Start.Position; offset++)
                    {
                        switch (snapshot[node.Position - offset - 1])
                        {
                        case ' ':
                        case '\t':
                            continue;

                        default:
                            break;
                        }
                        break;
                    }
                }
                extensionSpan = new SnapshotSpan(snapshot, node.Position - offset, offset);
            }
            foreach (IEnumerable <INode> list in node.Nodes.Values)
            {
                foreach (INode child in list)
                {
                    children.Add(new DesignerNode(provider, this, snapshot, child));
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Creates the designer (proxy) node over the real syntax node passed in as a parameter
        /// Also recursively creates child nodes for all 'real' node children
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="snapshot"></param>
        /// <param name="node"></param>
        public DesignerNode(NodeProvider provider, DesignerNode parent, ITextSnapshot snapshot, INode node)
        {
            this.provider = provider;
            Parent = parent;
            this.node = node;
            if (node.NodeType == NodeType.ParsingContext)
            {
                snapshotSpan = new SnapshotSpan(snapshot, node.Position + node.Length, 0);
                extensionSpan = new SnapshotSpan(snapshot, node.Position, node.Length);
            }
            else
            {
                snapshotSpan = new SnapshotSpan(snapshot, node.Position, node.Length);
                int offset = 0;
                if (node.Values.GetEnumerator().MoveNext())
                {
                    ITextSnapshotLine line = snapshot.GetLineFromPosition(node.Position);

                    // if the Value list is not empty, expand the snapshotSpan
                    // to include leading whitespaces, so that when a user
                    // types smth in this space he will get the dropdown
                    for (; node.Position - offset > line.Extent.Start.Position; offset++)
                    {
                        switch (snapshot[node.Position - offset - 1])
                        {
                            case ' ':
                            case '\t':
                                continue;
                            default:
                                break;
                        }
                        break;
                    }
                }
                extensionSpan = new SnapshotSpan(snapshot, node.Position - offset, offset);
            }
            foreach (IEnumerable<INode> list in node.Nodes.Values)
                foreach (INode child in list)
                    children.Add(new DesignerNode(provider, this, snapshot, child));
        }
Пример #5
0
 internal TagName(Source source, DesignerNode node, SnapshotPoint point)
     : base(source, node, point)
 {
 }
Пример #6
0
 private TagCompletionSet(DesignerNode node, SnapshotPoint point)
     : base(node, point)
 {
 }
Пример #7
0
 public ValueCompletionSet(Source source, DesignerNode node, SnapshotPoint point)
     : base(source, node, point)
 {
 }
Пример #8
0
 public ValueCompletionSet(DesignerNode node, SnapshotPoint point)
     : base(node, point)
 {
 }
 internal TagNameCompletionSet(DesignerNode node, SnapshotPoint point)
     : base(node, point)
 {
 }
 protected override void Initialize(DesignerNode node, SnapshotPoint point)
 {
     base.Initialize(node, point);
     this.quote_char = node.SnapshotSpan.GetText()[0];
 }