<commit_before>﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using EnvDTE;
using EnvDTE80;
using Microsoft.Common.Core;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using static System.FormattableString;

namespace Microsoft.VisualStudio.R.Package.ProjectSystem {
    [Export(typeof(IProjectSystemServices))]
    internal sealed class ProjectSystemServices : IProjectSystemServices {
        public EnvDTE.Solution GetSolution() {
            DTE dte = VsAppShell.Current.GetGlobalService<DTE>();
            return dte.Solution;
        }

        public EnvDTE.Project GetActiveProject() {
            DTE dte = VsAppShell.Current.GetGlobalService<DTE>();
            if (dte.Solution.Projects.Count > 0) {
                try {
                    var projects = dte.Solution?.SolutionBuild?.StartupProjects as IEnumerable;
                    var e = projects?.GetEnumerator();
                    e?.MoveNext();
                    var projectName = e?.Current as string;
                    EnvDTE.Project p = null;
                    if (!string.IsNullOrEmpty(projectName)) {
                        p = dte.Solution.Projects.Item(projectName);
                    }
                     return p;<commit_msg>Simplify<commit_after>﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using EnvDTE;
using EnvDTE80;
using Microsoft.Common.Core;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using static System.FormattableString;

namespace Microsoft.VisualStudio.R.Package.ProjectSystem {
    [Export(typeof(IProjectSystemServices))]
    internal sealed class ProjectSystemServices : IProjectSystemServices {
        public EnvDTE.Solution GetSolution() {
            DTE dte = VsAppShell.Current.GetGlobalService<DTE>();
            return dte.Solution;
        }

        public EnvDTE.Project GetActiveProject() {
            DTE dte = VsAppShell.Current.GetGlobalService<DTE>();
            if (dte.Solution.Projects.Count > 0) {
                try {
                    var projects = dte.Solution?.SolutionBuild?.StartupProjects as IEnumerable;
                    var e = projects?.GetEnumerator();
                    e?.MoveNext();
                    var projectName = e?.Current as string;
                    return !string.IsNullOrEmpty(projectName) ? dte.Solution.Projects.Item(projectName) : null;
{'fraction_non_alphanumeric': 0.08789439793947199, 'fraction_numerical': 0.0019317450096587251, 'mean_word_length': 2.761501210653753, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6957081', 'n_tokens_mistral': 829, 'n_tokens_neox': 791, 'n_words': 198}