protected override void OnSetNextStatement(long threadId, string fileName, int line, int column)
        {
            var source = new Source {
                Name = Path.GetFileName(fileName), Path = fileName
            };
            var request = new GotoTargetsRequest(source, line)
            {
                Column = column
            };
            GotoTargetsResponse response;
            GotoTarget          target = null;

            try {
                response = protocolClient.SendRequestSync(request);
            } catch (Exception ex) {
                DebuggerLoggingService.LogError("[VSCodeDebugger] Requesting target locations failed", ex);
                throw new NotSupportedException(ex.Message);
            }

            foreach (var location in response.Targets)
            {
                if (location.Line <= line && location.EndLine >= line && location.Column <= column && location.EndColumn >= column)
                {
                    // exact match for location
                    target = location;
                    break;
                }

                if (target == null)
                {
                    // closest match so far...
                    target = location;
                }
            }

            if (target == null)
            {
                throw new NotSupportedException();
            }

            try {
                protocolClient.SendRequestSync(new GotoRequest((int)threadId, target.Id));
            } catch (Exception ex) {
                DebuggerLoggingService.LogMessage("[VSCodeDebugger] Setting next statement failed", ex);
                throw new NotSupportedException(ex.Message);
            }

            RaiseStopEvent();
        }
        protected override void OnSetNextStatement(long threadId, string fileName, int line, int column)
        {
            var source = new Source {
                Name = Path.GetFileName(fileName), Path = fileName
            };
            var request = new GotoTargetsRequest(source, line)
            {
                Column = column
            };
            var response = protocolClient.SendRequestSync(request);
            var target   = response.Targets.FirstOrDefault(x => x.Line <= line && x.EndLine >= line && x.Column <= column && x.EndColumn >= column);

            if (target == null)
            {
                throw new NotSupportedException();
            }

            protocolClient.SendRequestSync(new GotoRequest((int)threadId, target.Id));
            RaiseStopEvent();
        }
Beispiel #3
0
        protected override void OnSetNextStatement(long threadId, string fileName, int line, int column)
        {
            var source = new Source {
                Name = Path.GetFileName(fileName), Path = fileName
            };
            var request = new GotoTargetsRequest(source, line)
            {
                Column = column
            };
            var        response = protocolClient.SendRequestSync(request);
            GotoTarget target   = null;

            foreach (var location in response.Targets)
            {
                if (location.Line <= line && location.EndLine >= line && location.Column <= column && location.EndColumn >= column)
                {
                    // exact match for location
                    target = location;
                    break;
                }

                if (target == null)
                {
                    // closest match so far...
                    target = location;
                }
            }

            if (target == null)
            {
                throw new NotImplementedException();
            }

            protocolClient.SendRequestSync(new GotoRequest((int)threadId, target.Id));
            RaiseStopEvent();
        }