Esempio n. 1
0
            private IVsDebugName CreateDebugName(
                BreakpointResolutionResult breakpoint,
                Solution solution,
                CancellationToken cancellationToken
                )
            {
                var document = breakpoint.Document;
                var filePath = _languageService.Workspace.GetFilePath(document.Id);
                var text     = document.GetTextSynchronously(cancellationToken);
                var span     = text.GetVsTextSpanForSpan(breakpoint.TextSpan);

                // If we're inside an Venus code nugget, we need to map the span to the surface buffer.
                // Otherwise, we'll just use the original span.
                if (
                    !span.TryMapSpanFromSecondaryBufferToPrimaryBuffer(
                        solution.Workspace,
                        document.Id,
                        out var mappedSpan
                        )
                    )
                {
                    mappedSpan = span;
                }

                return(new VsDebugName(breakpoint.LocationNameOpt, filePath, mappedSpan));
            }
Esempio n. 2
0
        private BreakpointResolutionResult CreateBreakpoint(ISymbol methodSymbol)
        {
            var location = methodSymbol.Locations.First(loc => loc.IsInSource);

            var document    = _solution.GetDocument(location.SourceTree);
            var textSpan    = new TextSpan(location.SourceSpan.Start, 0);
            var vsDebugName = methodSymbol.ToDisplayString(s_vsDebugNameFormat);

            return(BreakpointResolutionResult.CreateSpanResult(document, textSpan, vsDebugName));
        }
        internal static async Task <BreakpointResolutionResult> GetBreakpointAsync(Document document, int position, CancellationToken cancellationToken)
        {
            var tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);

            if (!BreakpointSpans.TryGetBreakpointSpan(tree, position, cancellationToken, out var span))
            {
                return(null);
            }

            if (span.Length == 0)
            {
                return(BreakpointResolutionResult.CreateLineResult(document));
            }

            return(BreakpointResolutionResult.CreateSpanResult(document, span));
        }
            private async ValueTask <IVsDebugName> CreateDebugNameAsync(
                BreakpointResolutionResult breakpoint, CancellationToken cancellationToken)
            {
                var document = breakpoint.Document;
                var filePath = _languageService.Workspace.GetFilePath(document.Id);
                var text     = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);

                var span = text.GetVsTextSpanForSpan(breakpoint.TextSpan);
                // If we're inside an Venus code nugget, we need to map the span to the surface buffer.
                // Otherwise, we'll just use the original span.
                var mappedSpan = await span.MapSpanFromSecondaryBufferToPrimaryBufferAsync(
                    _threadingContext, document.Id, cancellationToken).ConfigureAwait(false);

                if (mappedSpan != null)
                {
                    span = mappedSpan.Value;
                }

                return(new VsDebugName(breakpoint.LocationNameOpt, filePath, span));
            }
Esempio n. 5
0
        /// <summary>
        /// Returns null if a breakpoint can't be placed at the specified position.
        /// </summary>
        public async Task <BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
        {
            try
            {
                var tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);

                if (tree == null || !BreakpointSpans.TryGetBreakpointSpan(tree, textSpan.Start, cancellationToken, out var span))
                {
                    return(null);
                }

                if (span.Length == 0)
                {
                    return(BreakpointResolutionResult.CreateLineResult(document));
                }

                return(BreakpointResolutionResult.CreateSpanResult(document, span));
            }
            catch (Exception e) when(FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken))
            {
                return(null);
            }
        }
 private FSharpBreakpointResolutionResult(BreakpointResolutionResult result)
 => UnderlyingObject = result;
Esempio n. 7
0
 private VSTypeScriptBreakpointResolutionResultWrapper(BreakpointResolutionResult result)
 => UnderlyingObject = result;
 private FSharpBreakpointResolutionResult(BreakpointResolutionResult result) =>
Esempio n. 9
0
 private VSTypeScriptBreakpointResolutionResultWrapper(BreakpointResolutionResult result) =>