<commit_before>﻿using System;
using System.Runtime.InteropServices;
using Microsoft.R.Debugger.Engine;
using Microsoft.R.Debugger.Engine.PortSupplier;
using Microsoft.R.Host.Client;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Package.Utilities;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.R.Package.Repl.Debugger {
    internal sealed class AttachDebuggerCommand : DebuggerCommand {
        public AttachDebuggerCommand(IRSessionProvider rSessionProvider)
            : base(rSessionProvider, RPackageCommandId.icmdAttachDebugger, DebuggerCommandVisibility.DesignMode) {
        }

        protected unsafe override void Handle() {
            var session = _rSessionProvider.Current;
            if (session == null) {
                return;
            }

            var debugger = VsAppShell.Current.GetGlobalService<IVsDebugger2>(typeof(SVsShellDebugger));
            if (debugger == null) {
                return;
            }

            // Source active file
            ViewUtilities.SourceActiveFile();

            var pDebugEngines = stackalloc Guid[1];
            pDebugEngines[0] = DebuggerGuids.DebugEngine;

            uint pid = RDebugPortSupplier.GetProcessId(session.Id);
<commit_msg>Do not source current active script when attaching debugger.<commit_after>﻿using System;
using System.Runtime.InteropServices;
using Microsoft.R.Debugger.Engine;
using Microsoft.R.Debugger.Engine.PortSupplier;
using Microsoft.R.Host.Client;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Package.Utilities;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.R.Package.Repl.Debugger {
    internal sealed class AttachDebuggerCommand : DebuggerCommand {
        public AttachDebuggerCommand(IRSessionProvider rSessionProvider)
            : base(rSessionProvider, RPackageCommandId.icmdAttachDebugger, DebuggerCommandVisibility.DesignMode) {
        }

        protected unsafe override void Handle() {
            var session = _rSessionProvider.Current;
            if (session == null) {
                return;
            }

            var debugger = VsAppShell.Current.GetGlobalService<IVsDebugger2>(typeof(SVsShellDebugger));
            if (debugger == null) {
                return;
            }

            var pDebugEngines = stackalloc Guid[1];
            pDebugEngines[0] = DebuggerGuids.DebugEngine;

            uint pid = RDebugPortSupplier.GetProcessId(session.Id);

{'fraction_non_alphanumeric': 0.08212375859434683, 'fraction_numerical': 0.002291825821237586, 'mean_word_length': 3.047913446676971, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2138484', 'n_tokens_mistral': 691, 'n_tokens_neox': 685, 'n_words': 130}