private static async Task <Range> TranslateAsync(this Range range, OmniSharpWorkspace workspace, SimpleFileRequest request)
        {
            var(line, _) = await LineIndexHelper.TranslateFromGenerated(request.FileName, range.Start.Line, workspace, true);

            if (range.Start.Line == range.End.Line)
            {
                return(range with
                {
                    Start = range.Start with {
                        Line = line
                    },
                    End = range.End with {
                        Line = line
                    }
                });
Esempio n. 2
0
        private Task <SemanticHighlightSpan[]> GetSemanticHighlightsForLineAsync(TestFile testFile, int line)
        {
            var range = new OmniSharp.Models.V2.Range()
            {
                Start = new Point()
                {
                    Column = 0, Line = line
                },
                End = new Point()
                {
                    Column = 0, Line = line + 1
                }
            };

            return(GetSemanticHighlightsAsync(testFile, range));
        }
        private Task <SemanticHighlightSpan[]> GetSemanticHighlightsForLineAsync(TestFile testFile, int line, string versionedText)
        {
            var range = new Range()
            {
                Start = new Point()
                {
                    Column = 0, Line = line
                },
                End = new Point()
                {
                    Column = 0, Line = line + 1
                }
            };

            return(GetSemanticHighlightsAsync(testFile, range, versionedText));
        }
        private static Range GetSelection(TestHelpers.Range range)
        {
            Range selection = null;
            if (!range.IsEmpty)
            {
                var start = new Point { Line = range.Start.Line, Column = range.Start.Column };
                var end = new Point { Line = range.End.Line, Column = range.End.Column };
                selection = new Range { Start = start, End = end };
            }

            return selection;
        }
Esempio n. 5
0
        private async Task <SemanticHighlightSpan[]> GetSemanticHighlightsAsync(TestFile testFile, OmniSharp.Models.V2.Range range)
        {
            SharedOmniSharpTestHost.AddFilesToWorkspace(testFile);
            var requestHandler = GetRequestHandler(SharedOmniSharpTestHost);
            var request        = new SemanticHighlightRequest
            {
                FileName = testFile.FileName,
                Range    = range
            };

            var response = await requestHandler.Handle(request);

            return(response.Spans);
        }
        private async Task <SemanticHighlightSpan[]> GetSemanticHighlightsAsync(TestFile testFile, Range range, string versionedText)
        {
            SharedOmniSharpTestHost.AddFilesToWorkspace(testFile);
            var requestHandler = GetRequestHandler(SharedOmniSharpTestHost);
            var request        = new SemanticHighlightRequest
            {
                FileName      = testFile.FileName,
                Range         = range,
                VersionedText = versionedText,
            };

            var response = await requestHandler.Handle(request);

            return(response.Spans);
        }