<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Text;
using OmniSharp.Models;
using OmniSharp.Roslyn;

namespace OmniSharp
{
    public partial class OmnisharpController
    {
        [HttpPost("metadata")]
        public async Task<MetadataResponse> Metadata(MetadataRequest request)
        {
            var response = new MetadataResponse();
            foreach (var project in _workspace.CurrentSolution.Projects)
            {
                var compliation = await project.GetCompilationAsync();
                var symbol = compliation.GetTypeByMetadataName(request.TypeName);
                if (symbol != null && symbol.ContainingAssembly.Name == request.AssemblyName)
                {
                    var document = await MetadataHelper.GetDocumentFromMetadata(project, symbol);
                    if (document != null)
                    {
                        var source = await document.GetTextAsync();
                        response.SourceName = MetadataHelper.GetFilePathForSymbol(project, symbol);
                        response.Source = source.ToString();
<commit_msg>Added cancelation token, hopefully this will stop mono from going nuts if it cant find the source<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Text;
using OmniSharp.Models;
using OmniSharp.Roslyn;

namespace OmniSharp
{
    public partial class OmnisharpController
    {
        [HttpPost("metadata")]
        public async Task<MetadataResponse> Metadata(MetadataRequest request)
        {
            var response = new MetadataResponse();
            foreach (var project in _workspace.CurrentSolution.Projects)
            {
                var compliation = await project.GetCompilationAsync();
                var symbol = compliation.GetTypeByMetadataName(request.TypeName);
                if (symbol != null && symbol.ContainingAssembly.Name == request.AssemblyName)
                {
                    var cancelationSource = new CancellationTokenSource(TimeSpan.FromSeconds(2));
                    var document = await MetadataHelper.GetDocumentFromMetadata(project, symbol, cancelationSource.Token);
                    if (document != null)
                    {
                        var source = await document.GetTextAsync();
                        response.SourceName = MetadataHelper.GetFilePathForSymbol(project, symbol);
                        response.Source = source.ToString();

{'fraction_non_alphanumeric': 0.07604562737642585, 'fraction_numerical': 0.0003456619426201175, 'mean_word_length': 2.5422276621787026, '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': '531675', 'n_tokens_mistral': 687, 'n_tokens_neox': 666, 'n_words': 169}