<commit_before>namespace Atom.FSharp


open FunScript
open FunScript.TypeScript
open FunScript.TypeScript.fs
open FunScript.TypeScript.child_process
open FunScript.TypeScript.AtomCore
open FunScript.TypeScript.text_buffer

open Atom
open Atom.FSharp

[<ReflectedDefinition>]
module DeveloperMode =

    let mutable editor : IEditor option = None
    let mutable log = ""
    let private subscriptions = ResizeArray()

    let activate () =
        let s = Events.on Events.Log (unbox<Function> (fun (name,data) ->
            let timeString = System.DateTime.Now.ToLongTimeString().Replace("\\",".").Replace("/", ".")
            let t = (sprintf "[%s] %s: \n" timeString name) + data + "\n"
            editor |> Option.iter (fun e -> e.getBuffer().append t |> ignore)
            log <- log + t))
        subscriptions.Add s

        let s2 = Globals.atom.commands.add("atom-workspace", "Debug:Show Log", (unbox<Function> (fun _ ->
                    Globals.atom.workspace._open("Debug log", {split = "right"})._done((fun (ed : IEditor) ->
                        editor <- Some ed
                        ed.onDidDestroy((fun _ -> editor <- None) |> unbox<Function>) |> ignore
                        ed.insertText log |> ignore
                        let view = Globals.atom.views.getView ed
                        setComponentEnabled(view, false)) |> unbox<Function>)
                    )))
        subscriptions.Add s2
        ()<commit_msg>Debug log to file<commit_after>namespace Atom.FSharp


open FunScript
open FunScript.TypeScript
open FunScript.TypeScript.fs
open FunScript.TypeScript.child_process
open FunScript.TypeScript.AtomCore
open FunScript.TypeScript.text_buffer

open Atom
open Atom.FSharp

[<ReflectedDefinition>]
module DeveloperMode =

    let mutable editor : IEditor option = None
    let mutable log = ""
    let private subscriptions = ResizeArray()

    let activate () =
        let p = Globals.atom.project.getPaths().[0]
        let s = Events.on Events.Log (unbox<Function> (fun (name,data) ->
            let timeString = System.DateTime.Now.ToLongTimeString().Replace("\\",".").Replace("/", ".")
            let t = (sprintf "[%s] %s: \n" timeString name) + data + "\n"
            Globals.appendFile (p + "/.ionide.debug", t)

            editor |> Option.iter (fun e -> e.getBuffer().append t |> ignore)
            log <- log + t))
        subscriptions.Add s

        let s2 = Globals.atom.commands.add("atom-workspace", "Debug:Show Log", (unbox<Function> (fun _ ->
                    Globals.atom.workspace._open("Debug log", {split = "right"})._done((fun (ed : IEditor) ->
                        editor <- Some ed
                        ed.onDidDestroy((fun _ -> editor <- None) |> unbox<Function>) |> ignore
                        ed.insertText log |> ignore
                        let view = Globals.atom.views.getView ed
                        setComponentEnabled(view, false)) |> unbox<Function>)
                    )))
        subscriptions.Add s2
        ()
{'fraction_non_alphanumeric': 0.12756792577866136, 'fraction_numerical': 0.0016567263088137839, 'mean_word_length': 2.144791666666667, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3807300', 'n_tokens_mistral': 892, 'n_tokens_neox': 854, 'n_words': 212}