Esempio n. 1
0
        public async Task <LocationOrLocations> Handle(TextDocumentPositionParams request, CancellationToken token)
        {
            Uri         documentUri = request.TextDocument.Uri;
            ServiceInfo service     = GetService(documentUri);

            if (service == null)
            {
                return(null);
            }

            var member = service.GetMemberReferencedAtPosition(new Position(request.Position));

            if (member?.Position != null)
            {
                var position = new Position(member.GetPart(ServicePartKind.Name)?.Position ?? member.Position);
                return(new LocationOrLocations(new Location {
                    Uri = documentUri, Range = new Range(position, position)
                }));
            }

            return(new LocationOrLocations());
        }
        public async Task <Hover> Handle(TextDocumentPositionParams request, CancellationToken token)
        {
            Uri         documentUri = request.TextDocument.Uri;
            ServiceInfo service     = GetService(documentUri);

            if (service == null)
            {
                return(null);
            }

            var member = service.GetMemberReferencedAtPosition(new Position(request.Position));

            if (member != null)
            {
                var position = new Position(member.Position);
                return(new Hover
                {
                    Contents = GetMarkup(member),
                    Range = new Range(position, position)
                });
            }

            return(null);
        }