Exemplo n.º 1
0
            private bool PushSelectionRange(ISyntaxRegion syntaxRegion)
            {
                if (syntaxRegion is DModule)
                {
                    return(true);
                }

                if (syntaxRegion.Location > caret || syntaxRegion.EndLocation < caret)
                {
                    return(false);
                }

                if (narrowestSelectionRange == null)
                {
                    narrowestSelectionRange = new SelectionRange {
                        Range = syntaxRegion.ToRange()
                    };
                }
                else if (syntaxRegion.IsWithinRange(narrowestSelectionRange.Range))
                {
                    narrowestSelectionRange = new SelectionRange
                    {
                        Range  = syntaxRegion.ToRange(),
                        Parent = narrowestSelectionRange
                    };
                }

                return(true);
            }
Exemplo n.º 2
0
        public static LocationOrLocationLink ToLocationOrLocationLink(INode node, bool linkSupport, ISyntaxRegion sourceSyntaxRegion = null)
        {
            var targetUri = new Uri(((DModule)node.NodeRoot).FileName);

            if (linkSupport)
            {
                return(new LocationOrLocationLink(new LocationLink
                {
                    TargetUri = targetUri,
                    TargetSelectionRange = node.ToNameLocationRange(),
                    TargetRange = node.ToRange(),
                    OriginSelectionRange = sourceSyntaxRegion.ToRange()
                }));
            }
            return(new LocationOrLocationLink(new Location
            {
                Uri = targetUri,
                Range = node.ToNameLocationRange()
            }));
        }